12.11. Configuration Files

12.11.1. /etc Layout

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

/etcGeneric system-specific configuration information.
/etc/defaultsDefault versions of system configuration files.
/etc/mailExtra sendmail(8) configuration and other MTA configuration files.
/etc/pppConfiguration for both user- and kernel-ppp programs.
/etc/namedbDefault location for named(8) data. Normally named.conf and zone files are stored here.
/usr/local/etcConfiguration files for installed applications. May contain per-application subdirectories.
/usr/local/etc/rc.drc(8) scripts for installed applications.
/var/dbAutomatically generated system-specific database files, such as the package database and the locate(1) database.

12.11.2. Hostnames /etc/resolv.conf

How a FreeBSD system accesses the Internet Domain Name System (DNS) is controlled by resolv.conf(5).

The most common entries to /etc/resolv.conf are:

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

A typical /etc/resolv.conf looks like this:

search example.com nameserver nameserver


Only one of the search and domain options should be used.

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

/etc/hosts is a simple text database which works in conjunction with DNS and NIS to provide host name to IP address mappings. Entries for local computers connected via a LAN can be added to this file 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 external DNS servers 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 localhost localhost.my.domain # # Imaginary network. # myname.my.domain myname # 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: # # - # - # - # # 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.) #

The format of /etc/hosts is as follows:

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

For example: myRealHostname.example.com myRealHostname foobar1 foobar2

Consult hosts(5) for more information.

All FreeBSD documents are available for download at http://ftp.FreeBSD.org/pub/FreeBSD/doc/

Questions that are not answered by the documentation may be sent to <freebsd-questions@FreeBSD.org>.

Send questions about this document to <freebsd-doc@FreeBSD.org>.