contents
Next: Resolver Robustness Up: The Resolver Library Previous: Resolver Environment Variables

Configuring Name Server Lookups-- resolv.conf

When configuring the resolver library to use the BIND name service for host lookups, you also have to tell it which name servers to use. There is a separate file for this, called resolv.conf. If this file does not exist or is empty, the resolver assumes the name server is on your local host.

If you run a name server on your local host, you have to set it up separately, as will be explained in the following section. If your are on a local network and have the opportunity to use an existing nameserver, this should always be preferred.

The most important option in resolv.conf is nameserver, which gives the IP-address of a name server to use. If you specify several name servers by giving the nameserver option several times, they are tried in the order given. You should therefore put the most reliable server first. Currently, up to three name servers are supported.

If no nameserver option is given, the resolver attempts to connect to the name server on the local host.

Two other options, domain and search deal with default domains that are tacked onto a hostname if BIND fails to resolve it with the first query. The search option specifies a list of domain names to be tried. The list items are separated by spaces or tabs.

If no search option is given, a default search list is constructed from the local domain name by using the domain name itself, plus all parent domains up to the root. The local domain name may be given using the domain statement; if none is given, the resolver obtains it through the getdomainname(2) system call.

If this sounds confusing to you, consider this sample resolv.conf file for the Virtual Brewery:

           # /etc/resolv.conf
           # Our domain
           domain         vbrew.com
           #
           # We use vlager as central nameserver:
           nameserver     191.72.1.1

When resolving the name vale, the resolver would look up vale, and failing this, vale.vbrew.com, and vale.com.


contents
Next: Resolver Robustness Up: The Resolver Library Previous: Resolver Environment Variables

Andrew Anderson
Thu Mar 7 23:22:06 EST 1996

Hosting by: Hurra Communications Ltd.
Generated: 2007-01-26 17:57:42