The Linux resolver is configured by two types of files. One type tells the resolver which name services to use and in what order to use them. That topic is discussed at the end of this chapter. The other configuration file, /etc/resolv.conf, configures the resolver for its interaction with the Domain Name System. Every time a process that uses the resolver starts, it reads the resolv.conf file, and caches the configuration for the life of the process. If the /etc/resolv.conf file is not found, a default configuration is used.
The default resolver configuration uses the hostname command to define the local domain. Everything after the first dot in the value returned by the hostname command is used as the default domain. For example, if hostname returns wren.foobirds.org, the default value for the local domain is foobirds.org.
The default configuration uses the local system as the name server. This means that you must run named if you don't create a resolv.conf file. Generally, I think you should create a resolv.conf file, even if you do run named on the local host. There are three reasons for this. First, the resolv.conf file provides a means of documenting the configuration. Anyone can read the file and see the configuration you selected for the resolver. Second, the default values that work with one version of BIND may change with a future release. If you explicitly set the values you want, you don't have to worry about how the default values change. And third, even if you are using the local machine as a name server, the resolv.conf file allows you to define backup servers to increase robustness.
Was this article helpful?