Online Book Reader

Home Category

UNIX System Administration Handbook - Evi Nemeth [185]

By Root 2907 0
address or hostname of the default gateway machine in the indicated file. If you use a hostname, it must be listed in the /etc/hosts file.

Configuring DNS


To configure a machine as a DNS client, you only need to edit one or two files: all systems require /etc/resolv.conf to be modified, and some require you to modify a “service switch” file as well.

The /etc/resolv.conf file lists the DNS domains that should be searched to resolve names that are incomplete (that is, not fully qualified, such as anchor instead of anchor.cs.colorado.edu) and the IP addresses of the name servers to contact for name lookups. A sample is shown here; for more detail, see page 411.

search cs.colorado.edu colorado.edu

nameserver 128.138.242.1

nameserver 128.138.243.151

nameserver 192.108.21.1

/etc/resolv.conf should list the “closest” stable name server first because the server in the first position will be contacted first. You can have up to three nameserver entries. If possible, you should always have more than one. The timeout period seems quite long, so if the first name server does not respond, your users will notice.

You will sometimes see a domain line instead of a search line. Such a line indicates either an ancient resolv.conf file that has not been updated to use the search directive or an ancient resolver that doesn’t understand search. domain and search are not equivalent; search is preferred.

Some systems do not use DNS by default, even if a properly configured resolv.conf file exists. These systems have a “service switch” file that determines which mechanisms will be used to resolve hostname-to-IP-address mappings. Prioritization of information sources is covered in more detail starting on page 523, but we mention the topic here as well, since it sometimes foils your attempts to configure a new machine.

See Chapter 18 for more information about NIS and NIS+.

The service switch file lets you specify the order in which DNS, NIS (or NIS+), and /etc/hosts should be consulted. In most cases, you can also rule out certain sources of data entirely. Your choice of order impacts the machine’s ability to boot and the way that booting interacts with the contents of the /etc/hosts file.

If DNS is chosen as the first data source to consult, you may need to have a name server on the local network and have its hostname and IP address in the hosts file in order for everything to work at boot time.

Table 13.14 lists the location of the relevant config files and the default configuration for host lookups on each of our example systems.

Table 13.14 Service switch files by system

a Most applications are linked against libc6, which uses BIND’s resolver and nsswitch.conf. A few older applications are linked with libc5, which uses host.conf.

The default value under Solaris is actually determined by the options that were selected during the installation process. The entry to change is called hosts through Solaris 7; Solaris 8 and later add an ipnodes line that also refers to the hostname-to-IP-address mapping process.

The entries for both Solaris and HP-UX include the clause [NOTFOUND=return], which specifies what to do if a lookup should fail. If the service is running but the name is not found, this clause makes the lookup terminate (fail) immediately. The process continues to the next service listed only if the first is unavailable. Several other determinants can be part of a conditional phrase (SUCCESS, UNAVAIL, and TRYAGAIN), and two actions are defined (return and continue).

Solaris and HP-UX both provide some sample switch configurations in /etc; check for files called nsswitch.*. The HP-UX default settings are in nsswitch.hp_defaults.

13.11 VENDOR-SPECIFIC NETWORK CONFIGURATION


On older systems, you configured the network by editing the startup script /etc/rc (or perhaps /etc/rc.local) and directly changing the ifconfig and route commands it contained. Modern systems are set up to minimize the number of modifications that are made to the actual startup scripts.

The newer scripts reuse configuration

Return Main Page Previous Page Next Page

®Online Book Reader