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 the following:

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 is this:

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 is as follows:

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 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 following line:

hosts: files [NOTFOUND=return] dns nisplus nis

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.0.3 teletran.hudson.com teletran webserver #always breaks

192.168.0.4 optimus.hudson.com  optimus mailserver

192.168.0.5 prowl.hudson.com    prowl music repository

192.168.0.6 megatron.hudson.com fileserver

...

This example shows a short list of hosts. The format of the file is an IP address, a host name/domain name, and aliases (such as teletran and optimus). 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 teletran). 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 aliases — along with ensuring that changes are regularly updated to every host on the network — can 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 by going to System, Administration and choosing Network. Choose the Hosts tab to edit the file.

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.0.1

nameserver 192.168.0.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 these terms are explained shortly). If you have both, the last term listed is used.

You can configure the information in /etc/resolv.conf from the system-config- network tool by launching the tool from the Network menu item in the System Settings menu. The DNS tab enables you to enter or edit the DNS information, as shown in Figure 23.1.

FIGURE 23.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.

Essential DNS Concepts

We begin with a look at the ideas behind DNS prior to discussing the details of the soft ware used to implement it. An understanding at this level is invaluable in avoiding the majority of problems that administrators commonly experience with DNS, as well as in diagnosing and quickly solving the ones that do occur. The following overview omits several small details in the protocol because they are not relevant to the everyday tasks of a DNS administrator. If you need more information about DNS, consult the DNS standards, especially RFC 1034. The RFCs related to DNS are distributed with BIND. Fedora installs them in /usr/share/doc/bind-*/rfc/.

The domain namespace is structured as a tree. Each domain is a node in the tree and has a name. For every node, there are resource records (RRs) — each of which stores a single fact about the domain. (Who owns it? What is its IP address?) Domains can have any number of children, or subdomains. The

Добавить отзыв
ВСЕ ОТЗЫВЫ О КНИГЕ В ИЗБРАННОЕ

0

Вы можете отметить интересные вам фрагменты текста, которые будут доступны по уникальной ссылке в адресной строке браузера.

Отметить Добавить цитату