6.7 Configuration Files

6.7.1 /etc Layout

There are a number of directories in which configuration information is kept. These include:

/etc Generic system configuration information; data here is system-specific.
/etc/defaults Default versions of system configuration files.
/etc/mail Extra sendmail(8) configuration, other MTA configuration files.
/etc/ppp Configuration for both user- and kernel-ppp programs.
/etc/namedb Default location for named(8) data. Normally the boot file is located here, and contains a directive to refer to other data in /var/db.
/usr/local/etc Configuration files for installed applications. May contain per-application subdirectories.
/usr/local/etc/rc.d Start/stop scripts for installed applications.
/var/db Persistent system-specific data files, such as named(8) zone files, database files, and so on.

6.7.2 Hostnames

6.7.2.1 /etc/resolv.conf

/etc/resolv.conf dictates how FreeBSD's resolver accesses the Internet Domain Name System (DNS).

The most common entries to resolv.conf are:

nameserver The IP address of a name server the resolver should query. The servers are queried in the order listed with a maximum of three.
search Search list for hostname lookup. This is normally determined by the domain of the local hostname.
domain The local domain name.

A typical resolv.conf:

    search example.com
    nameserver 147.11.1.11
    nameserver 147.11.100.30

If you are using DHCP, dhclient(8) usually rewrites resolv.conf with information received from the DHCP server.

6.7.2.2 /etc/hosts

/etc/hosts is a simple text database reminiscent of the old Internet. It works in conjunction with DNS and NIS providing name to IP address mappings. Local computers connected via a LAN can be placed in here for simplistic naming purposes instead of setting up a named(8) server. Additionally, /etc/hosts can be used to provide a local record of Internet names, reducing the need to query externally for commonly accessed names.

    # $FreeBSD$
    #
    # Host Database
    # This file should contain the addresses and aliases
    # for local hosts that share this file.
    # In the presence of the domain name service or NIS, this file may
    # not be consulted at all; see /etc/nsswitch.conf for the resolution order.
    #
    #
    ::1                     localhost localhost.my.domain myname.my.domain
    127.0.0.1               localhost localhost.my.domain myname.my.domain
    
    #
    # Imaginary network.
    #10.0.0.2               myname.my.domain myname
    #10.0.0.3               myfriend.my.domain myfriend
    #
    # According to RFC 1918, you can use the following IP networks for
    # private nets which will never be connected to the Internet:
    #
    #       10.0.0.0        -   10.255.255.255
    #       172.16.0.0      -   172.31.255.255
    #       192.168.0.0     -   192.168.255.255
    #
    # In case you want to be able to connect to the Internet, you need
    # real official assigned numbers.  PLEASE PLEASE PLEASE do not try
    # to invent your own network numbers but instead get one from your
    # network provider (if any) or from the Internet Registry (ftp to
    # rs.internic.net, directory `/templates').
    #

/etc/hosts takes on the simple format of:

    [Internet address] [official hostname] [alias1] [alias2] ...

For example:

    10.0.0.1 myRealHostname.example.com myRealHostname foobar1 foobar2

Consult hosts(5) for more information.

6.7.3 Log File Configuration

6.7.3.1 syslog.conf

syslog.conf is the configuration file for the syslogd(8) program. It indicates which types of syslog messages are logged to particular log files.

    # $FreeBSD$
    #
    #       Spaces ARE valid field separators in this file. However,
    #       other *nix-like systems still insist on using tabs as field
    #       separators. If you are sharing this file between systems, you
    #       may want to use only tabs as field separators here.
    #       Consult the syslog.conf(5) manual page.
    *.err;kern.debug;auth.notice;mail.crit          /dev/console
    *.notice;kern.debug;lpr.info;mail.crit;news.err /var/log/messages
    security.*                                      /var/log/security
    mail.info                                       /var/log/maillog
    lpr.info                                        /var/log/lpd-errs
    cron.*                                          /var/log/cron
    *.err                                           root
    *.notice;news.err                               root
    *.alert                                         root
    *.emerg                                         *
    # uncomment this to log all writes to /dev/console to /var/log/console.log
    #console.info                                   /var/log/console.log
    # uncomment this to enable logging of all log messages to /var/log/all.log
    #*.*                                            /var/log/all.log
    # uncomment this to enable logging to a remote log host named loghost
    #*.*                                            @loghost
    # uncomment these if you're running inn
    # news.crit                                     /var/log/news/news.crit
    # news.err                                      /var/log/news/news.err
    # news.notice                                   /var/log/news/news.notice
    !startslip
    *.*                                             /var/log/slip.log
    !ppp
    *.*                                             /var/log/ppp.log

Consult the syslog.conf(5) manual page for more information.

6.7.3.2 newsyslog.conf

newsyslog.conf is the configuration file for newsyslog(8), a program that is scheduled to run normally by cron(8). newsyslog(8) determines when log files require archiving or rearranging. logfile is moved to logfile.0, logfile.0 is moved to logfile.1, and so on. Additionally, the log files may be archived in gzip(1) format causing them to be named: logfile.0.gz, logfile.1.gz, and so on.

newsyslog.conf indicates which log files are to be managed, how many are to be kept, and when they are to be touched. Log files can be rearranged and/or archived when they have either reached a certain size, or at a certain periodic time/date.

    # configuration file for newsyslog
    # $FreeBSD$
    #
    # filename          [owner:group]    mode count size when [ZB] [/pid_file] [sig_num]
    /var/log/cron                           600  3     100  *     Z
    /var/log/amd.log                        644  7     100  *     Z
    /var/log/kerberos.log                   644  7     100  *     Z
    /var/log/lpd-errs                       644  7     100  *     Z
    /var/log/maillog                        644  7     *    @T00  Z
    /var/log/sendmail.st                    644  10    *    168   B
    /var/log/messages                       644  5     100  *     Z
    /var/log/all.log                        600  7     *    @T00  Z
    /var/log/slip.log                       600  3     100  *     Z
    /var/log/ppp.log                        600  3     100  *     Z
    /var/log/security                       600  10    100  *     Z
    /var/log/wtmp                           644  3     *    @01T05 B
    /var/log/daily.log                      640  7     *    @T00  Z
    /var/log/weekly.log                     640  5     1    $W6D0 Z
    /var/log/monthly.log                    640  12    *    $M1D0 Z
    /var/log/console.log                    640  5     100  *     Z

Consult the newsyslog(8) manual page for more information.

6.7.4 sysctl.conf

sysctl.conf looks much like rc.conf. Values are set in a variable=value form. The specified values are set after the system goes into multi-user mode. Not all variables are settable in this mode.

A sample sysctl.conf turning off logging of fatal signal exits and letting Linux programs know they are really running under FreeBSD.

    kern.logsigexit=0       # Do not log fatal signal exits (e.g. sig 11)
    compat.linux.osname=FreeBSD
    compat.linux.osrelease=4.3-STABLE

This, and other documents, can be downloaded from ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/.

For questions about FreeBSD, read the documentation before contacting <questions@FreeBSD.org>.
For questions about this documentation, e-mail <doc@FreeBSD.org>.