Solaris Naming Setup and Configuration Guide

Chapter 12 Setting Up DNS Clients

This chapter describes how to set up Domain Name System (DNS) service on client machines.


Note -

One of the most common, and important, uses of DNS is connecting your network to the global Internet. In order to connect to the Internet, your network IP address must be registered with whomever is administering your parent domain. Who that administrator is varies according to your geographic location and type of parent domain. This manual does not describe how to register networks with domain administrators.


For more detailed information, see DNS and Bind, by Cricket Liu and Paul Albitz (O'Reilly, 1992).

Solaris DNS BIND Implementation

For your convenience, the Solaris 7 release supplies a compiled version of Berkeley Internet Name Domain (BIND) version 4.9.4, Patch-Level 1. In compiling this software, options and choices were made to meet the needs of the greatest number of sites. If this pre-compiled version of BIND does not meet your requirements, you can recompile your own version of BIND from the publicly available source code.

In compiling the BIND version supplied with the Solaris 7 release, the following choices were made:

Setting Up DNS Service

Setting up DNS service is accomplished in two basic steps:

  1. Set up DNS service on your client machines. This chapter describes how to do this.

  2. Set up your DNS servers as described in Chapter 13, Setting Up DNS Servers.

Client Set Up

Setting up DNS on a client machine involves two tasks:

If you are setting up DNS service on a host that will function as a DNS server, you also need to set up boot and data files, as described in Chapter 13, Setting Up DNS Servers.

The Resolver

DNS clients use the dynamic library routines, collectively called the resolver, to locate a remote host. The resolver queries the DNS database on a name server, which eventually returns the host name or IP address of the machine requested by the resolver. Because DNS name servers are clients of servers outside their local domains, they must also run the resolver.

The DNS name server uses several files to load its database. At the resolver level, it needs the file /etc/resolv.conf listing the addresses of the servers where it can obtain its information. The resolver reads this resolv.conf file to find 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 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.)

Whenever the resolver has to find the IP address of a host (or the host name corresponding to an address), the resolver 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.

Creating the resolv.conf File

A simple example resolv.conf file for a client (non-server) machine in the doc.com domain is shown in Example 12-1:


Example 12-1 Sample resolv.conf File


; Sample resolv.conf file for the machine polaris
domain doc.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
; sort the addresses returned by gethostbyname(3c)
sortlist
130.155.160.0/255.255.240.0
130.155.0.0

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


domain domainname

Where domainname is the name registered with the Internet governing bodies (as of this writing, the InterNIC).


Note -

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 form:


nameserver 127.0.0.1

Succeeding 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 form:


nameserver IP_address

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

The fifth line of the /etc/resolv.conf file lists the address sortlist in the form:


sortlist
addresslist

Where addresslist specifies the sort order of the addresses returned by gethostbyname(3c). In our example, gethostbyname returns the netmask pair 130.155.160.0/255.255.240.0 ahead of the IP address 130.155.0.0.

Modifying the /etc/nsswitch.conf File

How you enable a machine to use DNS depends on your underlying enterprise-level name service:

For additional information on the nsswitch.conf file, see Solaris Naming Administration Guide.