Configuring DNS for Clients


Later in the chapter, we will focus on setup and configuration in order to provide DNS. In this section, we briefly examine the setup and configuration required for a computer to use DNS services. The important user setup and configuration processes for DNS is likely to have been accomplished during the initial installation of Fedora Core. After the initial installation, further DNS configuration can be accomplished by one or more of these methods:

Using Dynamic Host Control Protocol (DHCP), in which case some system settings are updated by the dhclient command without intervention by a local or remote administrator or user

Using the system-config-network GUI configuration tool

Manually editing the system's /etc/host.conf configuration file to specify the methods and order of name resolution

Manually editing the system's /etc/nsswitch.conf configuration file to specify the methods and order of name resolution

Manually editing the system's /etc/hosts file, which lists specific hostnames and IP addresses

Manually editing the system's /etc/resolv.conf configuration file to add nameserver, domain, or search definition entries

Successful DNS lookups depend on the system's networking being enabled and correctly configured. You can learn more about how to accomplish that in Chapter 18, "Network Connectivity."

When an application needs to resolve a hostname, it calls system library functions to do the name resolution. If the GNU C library installed is version 2 or greater, the /etc/nsswitch.conf configuration file is used. Older versions of the library use /etc/host.conf. Fedora uses the newer GNU C library, but /etc/host.conf is still provided for applications that have been statically linked with other libraries. The two files should be kept in sync.

Understanding the /etc/host.conf File

The /etc/host.conf file, known as the resolver configuration file, specifies which services to use for name resolution and the order in which they are to be used. This file has been superseded by /etc/nsswitch.conf, but is still provided for applications that use other libraries.

By default with Fedora, this file contains

order hosts,bind


The order shown here is to first consult /etc/hosts for a hostname. If the hostname is found in /etc/hosts, use the IP address specified there. If the hostname is not found in /etc/hosts, TRy to resolve the name using DNS (BIND).

One other option is available, although it is not set by default. This is NIS, which is Sun's Network Information Service.

Understanding the /etc/nsswitch.conf File

The file /etc/nsswitch.conf is the system databases and name service switch configuration file. It contains methods for many types of lookups, but here we are concerned with DNS resolution, so the line we are interested in is the hosts line. This line defines the methods to be used for resolving hostnames and the order in which to apply them. The methods used are

db Local database files (*.db)

files Use the local file /etc/hosts

dns Use BIND

nis Use Sun's NIS

nisplus Use Sun's NIS+

The default line with Fedora Core is

hosts: files dns


With this default, the same methods and order are specified as in the default /etc/host.conf. First /etc/hosts is searched, and then DNS is used.

Another example would be

hosts: files dns nisplus nis


In this example, name searches that fail in /etc/hosts and with DNS continue to the NIS services (nisplus and nis). NIS included with Fedora Core is the ypserv daemon.

When you are testing your configuration, you might want to halt name searching at a specific point. You can use the entry [NOTFOUND=return]. For example, to stop searching after looking in /etc/hosts, you would use the line

hosts: files [NOTFOUND=return] dns nisplus nis


Understanding the /etc/hosts File

The file /etc/hosts contains a table of local hosts (hostnames and IP addresses) used for local DNS-type lookups. The file is used if the keyword hosts is included in the order line of /etc/host.conf.

Using /etc/hosts to provide hostnames and hostname aliases can be effective when used on small networks. For example, a short /etc/hosts might look like this:

... 192.168.2.3   dogdog.hudson.com    dogdog webserver #always breaks 192.168.2.4   humphrey.hudson.com    humphrey mailserver 192.168.2.5   pluto.hudson.com    pluto music repository 192.168.2.6   mickey.hudson.com    fileserver ...


This example shows a short list of hosts. The format of the file is an IP address, a hostname/domain name, and aliases (such as dogdog and mickey). Using this approach, a system administrator would maintain and update a master hosts list, and then replicate the complete /etc/hosts file to every computer on the LAN. Users are then able to access other systems by simply using the hostname alias (such as dogdog). The format of /etc/hosts is easy to understand and easy to maintain, and can be used in conjunction with DNS, and in conjunction with a Dynamic Host Configuration Protocol (DHCP) server on the same network.

Two disadvantages of using /etc/hosts become readily apparent on a large network: maintenance and replication. Maintaining huge lists of IP addresses, hostnames, and aliasesalong with ensuring that changes are regularly updated to every host on the networkcan be a challenge.

The /etc/hosts file can be edited with a text editor or with the system-config-network GUI configuration tool, which can be launched from the Network menu item in the System Settings menu. The Hosts tab allows editing the file.

Understanding the /etc/resolv.conf File

The file /etc/resolv.conf specifies how DNS searches are made. The file contains a list of nameservers (DNS servers to connect to) and some options. For example, a simple but usable /etc/resolv.conf generally contains at least two nameserver entries, specifying a primary and secondary nameserver. This example uses fictitious internal IP addresses:

nameserver 192.168.1.1 nameserver 192.168.1.2 search mydomain.com


The IP addresses listed in the /etc/resolv.conf file are usually assigned by an ISP and represent the remote nameservers. Other optional keywords, such as domain and search, are used to specify a local domain and search list for queries; the two terms are mutually exclusive, however (and we will explain these terms shortly). If you have both, the last term listed will be used.

The information in /etc/resolv.conf can be configured from the system-config-network tool by launching the tool from the Network menu item in the System Settings menu. The Devices tab (see Figure 27.1) allows you to enter or edit device information.

Figure 27.1. The GUI Network Configuration tool is one of Fedora's best-designed GUI tools, permitting extensive network configuration.


Understanding the Changes Made by DHCP

If your system is set to use DHCP, any existing /etc/resolv.conf is saved as resolv.conf.predhclient and a new /etc/resolv.conf is created with the DNS information supplied by DHCP when the DHCP connection is made. When DHCP is released, the saved file is moved back as /etc/resolv.conf.



Red Hat Fedora 5 Unleashed
Red Hat Fedora 5 Unleashed
ISBN: 067232847X
EAN: 2147483647
Year: 2004
Pages: 362

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net