Previous Page
Next Page

DNS

DNS is the name service used by the Internet and other Transmission Control Protocol/Internet Protocol (TCP/IP) networks. It was developed so that workstations on the network can be identified by common names instead of Internet addresses. DNS is a system that converts domain names to their IP addresses and vice versa. Without it, users would have to remember numbers instead of words to get around the Internet. The process of finding a computer's IP address by using its hostname as an index is referred to as name-to-address resolution, or mapping. DNS duplicates some of the information stored in the NIS or NIS+ tables, but DNS information is available to all hosts on the network.

The collection of networked systems that use DNS is referred to as the DNS namespace. The DNS namespace can be divided into a hierarchy of domains. A DNS domain is simply a group of systems. Two or more name servers support each domain: the primary, secondary, or cache-only server. Each domain must have one primary server and should have at least one secondary server to provide backup.

Configuring the DNS Client

On the client side, DNS is implemented through a set of dynamic library routines, collectively called the resolver. The resolver's function is to resolve users' queries. The resolver is neither a daemon nor a single program; instead, it is a set of dynamic library routines used by applications that need to find IP addresses given the domain names.

The resolver library uses the file /etc/resolv.conf, which lists the addresses of DNS servers where it can obtain its information. The resolver reads this /etc/resolv.conf file to find the name of the local domain and the location of domain name servers. It sets the local domain name and instructs the resolver routines to query the listed name servers for information. Normally, each DNS client system on your network has a resolv.conf file in its /etc directory. (If a client does not have a resolv.conf file, it defaults to using a server at IP address 127.0.0.1, which is the local host.) Here's an example of the /etc/resolv.conf file:

; Sample resolv.conf file for the machine server1
domain example.com
; try local name server
nameserver 127.0.0.1
; if local name server down, try these servers
nameserver 123.45.6.1
nameserver 111.22.3.5

The first line of the /etc/resolv.conf file lists the domain name in this form:

domain <domainname>

<domainname> is the name registered with the Internet's domain name servers.

Note

Domain Name Format No spaces or tabs are permitted at the end of the domain name. Make sure that you enter a hard carriage return immediately after the last character of the domain name.


The second line identifies the loopback name server in the following form:

nameserver 127.0.0.1

The remaining lines list the IP addresses of up to three DNS master, secondary, or cache-only name servers that the resolver should consult to resolve queries. (Do not list more than three primary or secondary servers.) Name server entries have the following form:

nameserver <IP_address>

<IP_address> is the IP address of a DNS name server. The resolver queries these name servers in the order they are listed until it obtains the information it needs.

Whenever the resolver must find the IP address of a host (or the hostname corresponding to an address), it builds a query package and sends it to the name servers listed in /etc/resolv.conf. The servers either answer the query locally or contact other servers known to them, ultimately returning the answer to the resolver.

After the resolver is configured, a system can request DNS service from a name server. If a system's /etc/nsswitch.conf file specifies hosts: dns, the resolver libraries are automatically used. If the nsswitch.conf file specifies some other name service before DNS, such as NIS, that name service is consulted first for host information. Only if that name service does not find the host in question are the resolver libraries used.

For example, if the hosts line in the nsswitch.conf file specifies hosts: nis dns, the NIS name service is first searched for host information. If the information is not found in NIS, the DNS resolver is used. Because name services such as NIS and NIS+ contain only information about hosts in their own network, the effect of a hosts: nis dns line in a switch file is to specify the use of NIS for local host information and DNS for information on remote hosts on the Internet. If the resolver queries a name server, the server returns either the requested information or a referral to another server.

Name-to-address mapping occurs if a program running on your local system needs to contact a remote computer. The program most likely knows the hostname of the remote computer but might not know how to locate it, particularly if the remote system is in another network. To obtain the remote system's address, the program requests assistance from the DNS software running on your local system, which is considered a DNS client.

The DNS client sends a request to a DNS name server, which maintains the distributed DNS database. Each DNS server implements DNS by running a daemon called in.named. When run without any arguments, in.named reads the default configuration file /etc/named.conf, loads DNS zones it is responsible for, and listens for queries from the DNS clients.

The files in the DNS database bear little resemblance to the NIS+ host table or even to the local /etc/hosts file, although they maintain similar information: the hostnames, IP addresses, and other information about a particular group of computers. The name server uses the hostname that your system sent as part of its request to find or "resolve" the IP address of the remote system. It then returns this IP address to your local system if the hostname is in its DNS database.

If the hostname is not in that name server's DNS database, this indicates that the system is outside its authorityor, to use DNS terminology, outside the local administrative domain. If your network is connected to the Internet, then external servers will be consulted to try and resolve the hostname.

Because maintaining a central list of domain name/IP address correspondences would be impractical, the lists of domain names and IP addresses are distributed throughout the Internet in a hierarchy of authority. A DNS server that maps the domain names in your Internet requests or forwards them to other servers the Internet. It is probably provided by your Internet access provider.


Previous Page
Next Page