-->
Previous Table of Contents Next


The following is a sample /etc/resolv.conf file for tristar.com:


# /etc/resolv.conf for tristar.com

#

# Set our local domain name

domain tristar.com

# Specify our primary name server

nameserver 166.82.1.3

In this example, you specify the local domain via the domain option and list one name server to use for resolving host names.


NOTE:  You need to specify the IP address of the DNS name server as an argument to the nameserver option—not the host name. If you specify the host name, DNS doesn’t know what host to contact to look up the host name of the name server.

You didn’t use the search option to specify the search order. This means that if you try to query the address of a machine—for example, skippy—the resolver tries to look up skippy first. If this fails, it looks up skippy.tristar.com, and then skippy.com.

DNS servers can and do go down unexpectedly. If you rely solely on a DNS server for name resolution, you may find yourself unable to work if it crashes. Make sure that you specify multiple servers and keep a good list of hosts in your local /etc/hosts file, just in case.

Using the named Daemon to Set Up the Server

Here is where the real magic starts. You’ve seen how to set up the basics of resolver configuration and how to tell your resolver which name servers to contact. In the following sections, you learn the mechanics of setting up a name server.

The DNS name server under Linux is provided by the named (pronounced name-deè ) daemon. This daemon is typically started at boot time and reads its configuration information from a set of configuration files. named typically runs until the machine is shut down. After named starts and is initialized with its configuration information, it writes its process ID to the /etc/named.pid ASCII file. It then starts listening for DNS requests on the default network port specified in /etc/services.

The named.boot File

The first file that named reads when it starts is typically /etc/named.boot. This very small file is the key to all the other configuration files used by named—it contains pointers to the various configuration files and to other name servers. In the named.boot file, comments start with a semicolon and continue to the end of the line. Several options can be listed in the named.boot file; Table 25.4 lists these options.

Table 25.4 Configuration Options for the named.boot File

Option Description

directory Specifies the directory where the DNS zone files are located. You can specify several different directories by using the directory option repeatedly. You can give file path names as being relative to these directories.
primary Takes a domain name and file name as arguments. The primary option declares named to be authoritative for the specified domain and causes named to load the zone information from the specified file.
secondary Tells named to act as a secondary server for the specified domain. It takes a domain name, a list of addresses, and a file name as arguments. named tries to transfer the zone information from the hosts specified in the address list and then stores the zone information in the file specified on the option line. If named can’t contact any of the hosts, it tries to retrieve the information from the secondary zone file.
cache Sets up caching information for named. Takes a domain name and a file name as arguments. The domain name is typically specified as . (dot). The file contains a set of records, known as server hints, which list information about the root name servers.
forwarders Takes a list of name servers as arguments. Tells the local name server to try to contact the servers in this list if it can’t resolve an address from its local information.
slave Turns the local name server into a slave server. If the slave option is given, the local server tries to resolve DNS names via recursive queries. It simply forwards the request to one of the servers listed in the forwarders option line.

In addition to these options, a few additional options aren’t commonly used. Refer to the named man page for more information on these options.


NOTE:  Because tristar.com isn’t attached to the Internet, many of the IP host and network addresses in these examples are fake. When setting up your own name server, make sure that you use the correct addresses assigned to you.

The following is a sample named.boot file:


; named.boot file

; A sample named.boot for tristar.com

;

directory /var/named

;

cache. named.ca

primary tristar.com named.hosts

primary 197.198.199.in-addr.arpa named.rev

This example sets up the primary name server for tristar.com. As you can see, comments start with the ; character. The directory statement in the file tells named that all its working files are located in the /var/named directory. Because none of the other files listed in the named.boot file have directory paths associated with them, they’re located in /var/named.

The next line sets up the caching information for this name server. This option should be present on almost every machine running as a name server. It tells named to enable caching and load the root server information from the file named.ca.


NOTE:  The cache entry is very important. Without it, no caching is enabled on the local name server. This can cause severe performance problems for name lookups. Also, the local server can’t contact any root name servers and, as a result, can’t resolve any non-local host names, unless it’s set up as a forwarding name server.

The next line in the named.boot file tells named that this server has primary authority for the domain tristar.com. The zone and host information records are in the file named.hosts. You learn about these zone authority records in detail in the following section.


Previous Table of Contents Next