Solaris Naming Setup and Configuration Guide

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.