Name Services Configuration Guide
  Search only this book
Download this book in PDF

Setting Up DNS Clients

9

Setting up DNS on a client involves two tasks:
  • creating the resolv.conf file
  • modifying the /etc/nsswitch.conf file
If you are setting up DNS on a name server, you need to complete these steps, in addition to setting up boot and data files. The server tasks are described in Chapter 10, "Setting Up DNS Servers".

Creating resolv.conf

The domain name server uses several files to load its database. At the resolver level, it needs a file (called /etc/resolv.conf) listing the addresses of the servers where it can obtain the information needed. Whenever the resolver has to find the address of a host (or the name corresponding to an address) it builds a query package and sends it to the name servers it knows of (from /etc/resolv.conf). The servers either answer the query locally or use the services of other servers and return the answer to the resolver.
The resolv.conf file is read by the resolver to find out the name of the local domain and the location of name servers. It sets the local domain name and instructs the resolver routines to query the listed names servers for information. Every DNS client system on your network must have a resolv.conf file in its /etc directory.
The first line of the file lists the domain name in the form:

  domain domain_name  

where domain_name is the name registered with the NIC (Network Information Center, an agency of the National Science Foundation). Succeeding lines list the IP addresses that the resolver should consult to resolve queries. IP address entries have the form:

  nameserver IP_address  

Below is a sample resolv.conf file.

  ; Sample resolv.conf file  
  domain Podunk.Edu.  
  ; try local name server  
  nameserver 127.0.0.1  
  ; if local name server down, try these servers  
  nameserver 128.32.0.4  
  nameserver 128.32.0.10  

Modifying /etc/nsswitch.conf

To use DNS as the source of hostname information, follow the directions for enabling an NIS+ client to use DNS in Name Services Administration Guide.