FreeBSD Handbook
Prev | Chapter 12 Configuration and Tuning | Next

# 12.11 Configuration Files

## 12.11.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 `named.conf` and zone files are stored here.
`/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` | Automatically generated system-specific database files, such as the package database, the locate database, and so on

## 12.11.2 Hostnames

### 12.11.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

> Note: Only one of the `search` and `domain` options should be used.

When using DHCP, dhclient(8) usually rewrites `resolv.conf` with information received from the DHCP server.

### 12.11.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.  Replace 'my.domain' below with the domainname of your
    # machine.
    #
    # 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
    127.0.0.1		localhost localhost.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.  Do not try to invent your own network
    # numbers but instead get one from your network provider (if any) or
    # from your regional registry (ARIN, APNIC, LACNIC, RIPE NCC, or AfriNIC.)
    #

`/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.

## 12.11.3 `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.

To turn off logging of fatal signal exits and prevent users from seeing processes started from other users, the following tunables can be set in `sysctl.conf`:

    # Do not log fatal signal exits (e.g., sig 11)
    kern.logsigexit=0

    # Prevent users from seeing information about processes that
    # are being run under another UID.
    security.bsd.see_other_uids=0

Prev | Home | Next
Configuring the System Logger, syslogd | Up | Tuning with sysctl(8)