UNIX System Administration Handbook - Evi Nemeth [235]
SPURGEON, CHARLES. “Guide to Ethernet.”
http://wwwhost.ots.utexas.edu/ethernet/ethernet-home.html
16 The Domain Name System
Zillions of hosts are connected to the Internet. How do we keep track of them all when they belong to so many different countries, networks, and administrative groups? Two key pieces of infrastructure hold everything together: the Domain Name System (DNS), which keeps track of who the hosts are, and the Internet routing system, which keeps track of how they are connected.
This chapter is about the DNS portion of that system. Although DNS has come to serve several different purposes, its primary job is to map between hostnames and IP addresses. Users and user-level programs like to refer to machines by name, but low-level network software understands only numbers. DNS provides the glue that keeps everyone happy. It has also come to play an important role in the routing of email.
DNS is a distributed database. “Distributed” means that my site stores the data about its computers, your site stores the data about your computers, and somehow, our sites automatically cooperate and share data when one site needs to look up some of the other’s data.
16.1 DNS FOR THE IMPATIENT: ADDING A NEW MACHINE
This chapter is almost a mini-book in itself. Before we dive into its mind-numbing depths, let’s take a quick breather to answer the most common DNS question: How do you add a new host to a network that’s already using DNS? The following recipe shows you how to do it by copying and modifying the existing records for a similar computer—templatehost.my.domain.
Step 1: Choose a hostname and IP address for the new machine in conjunction with local sysadmins or your upstream ISP (Internet service provider).
Step 2: Identify a similar machine on the same subnet. We’ll use that machine’s records as a model for our new ones.
Step 3: Log in to the master name server machine.
Step 4: Look through /etc/named.conf or /etc/namedb/named.conf:
• From the options statement, find the directory line that tells where zone data files are kept at your site (see page 418). The zone files contain the actual host and IP address data.
• From the zone statements, find the filenames for the forward zone file and for the reverse zone file of the network your new IP address is on (page 424).
Step 5: Go to the zone file directory and edit the forward zone file (using RCS and sudo, of course). Find the records for the template host you identified earlier. They’ll look something like this:
templatehost IN A 128.138.243.100
IN MX 10 mail-hub
IN MX 20 templatehost
Step 6: Duplicate those records and change them appropriately for your new host. The zone file might be sorted by hostname; follow the existing convention. Also change the serial number in the SOA record at the beginning of the file (it’s the first of the five numbers in the SOA record). The serial number should only increase; add 1 if your site uses an arbitrary serial number, or set the field to the current date if your site uses that convention.
Step 7: Edit the reverse zone file,1
duplicate the record for the template host, and update it. It should look something like this:
100 IN PTR templatehost.my.domain.
You must also update the serial number in the SOA record of the reverse zone file.
If your reverse zone file shows more than just the last byte of each host’s IP address, you must enter the bytes in reverse order. For example, the record
100.243 IN PTR templatehost.my.domain.
corresponds to the IP address 128.138.243.100 (here, the reverse zone is relative to 138.128.in-addr.arpa rather than 243.138.128.in-addr.arpa).
Step 8: While still logged in to the master name server machine, run ndc reload.2
Step 9: Try to ping or traceroute to your new host’s name, even if the new host has not been set up yet. A “host unknown” message means