-->

Previous | Table of Contents | Next

Page 263

SOA—Start of Authority

The SOA record starts the description of a site's DNS entries. The format of this entry is as follows:


domain.com. IN ns1.domain.com. hostmaster.domain.com. (

    1997082401        ; serial number

    10800            ; refresh rate in seconds (3 hours)

    1800            ; retry in seconds (30 minutes)

    1209600        ; expire in seconds (2 weeks)

    604800 )        ; minimum in seconds (1 week)

The first line begins with the domain for which this SOA record is authoritative. This entry is followed by IN to indicate that the Internet standard is being used. The column after the IN is the primary nameserver for this domain. Finally, the last column specifies the e-mail address for the person in charge. Note that the e-mail address is not in the standard user@domain.com form, but instead has the @ symbol replaced by a period. It is good practice to create the mail alias hostmaster at your site and have all mail sent to it forwarded to the appropriate people.

TIP
Remember how I said that periods were important in DNS records? You should have then noticed that all of the fully qualified hostnames were suffixed with a period. Incorrectly placed periods anywhere in DNS-related files will cause grief and be difficult to track down later.

At the end of the first line is an open parenthesis. This tells named that the line continues onto the next line, thereby making the file easier to read.

The five values presented in subsequent lines detail the characteristics of this record. The first line is the record's serial number. Whenever you make a change to any entry in this file, you need to increment this value so that secondary servers know to perform zone transfers. Typically, the current date in the form YYYYMMDDxx is used, where YYYY is the year, MM is the month, DD is the day, and xx is the revision done that day. (This allows for multiple revisions in one day.)

The second value is the refresh rate in seconds. This value tells the secondary DNS servers how often they should query the primary server to see if the records have been updated at all.

The third value is the retry rate in seconds. If the secondary server tries to contact the primary DNS server to check for updates but cannot contact it, the secondary server tries again after retry seconds.

Page 264

The fourth value indicates to secondary servers that have cached the entry that if they cannot contact the primary server for an update, they should discard the value after the specified number of seconds. One to two weeks is a good value for this.

The final value, the minimum entry, tells caching servers how long they should wait before expiring an entry if they cannot contact the primary DNS server. Five to seven days is a good guideline for this entry.

Don't forget to place a closing parenthesis after the fifth value.

NS—Nameserver

The NS record specifies the authoritative nameservers for a given domain. A sample line for this is


IN NS    ns1.domain.com.

IN NS    ns2.domain.com.

Note that if the domain name for the nameserver applies to the current SOA record, you do not need to specify the name field in the DNS record.

In this example, there are two nameservers for the domain, domain.com: ns1.domain.com and ns2.domain.com. These are fully qualified hostnames, so they need to have the period to suffix them. Without the period, named will evaluate their value to be ns1.domain.com.domain.com, which is not what you're looking for.

A—Address Record

The address record is used for providing translations from hostnames to IP addresses. There should be an A record for all your machines you want to have a known hostname. A sample entry using the A record is


toybox    IN A        192.168.42.59

In this example, the address is specified for the host toybox. There is not a period after its name, so named will assume its domain from the current SOA record, thereby making it toybox.domain.com.

PTR—Pointer Record

The pointer record, also known as reverse resolution record, tells named how to turn an IP address into a hostname. PTR records are a little odd, however, in that they should not be in the same SOA as your A records. You will see why when you configure a small primary DNS server later in this section.

A PTR record looks like this:


59.42.168.192.  IN PTR  toybox.domain.com.

Notice that the IP address to be reverse-resolved is in reverse order and is suffixed with a period.

Page 265

MX—Mail Exchanger

The mail exchanger record enables you to specify which host in your network is in charge of receiving mail from the outside. sendmail uses this record to determine the correct machine mail needs to be sent to. The format of an MX record looks like this:


domain.com.    IN MX 10    mailhub

               IN MX 50    mailhub2

The first column indicates the hostname for which mail is received. In this case, it is for domain.com. Based on the previous examples, you might have noticed that you have yet to specify a machine that answers to domain.com. only, yet the sample MX record shows that you can accept mail for it. This is an important feature of DNS: You can specify a hostname for which you accept mail without that hostname having an A record.

As expected, the IN class is the second column. The third column specifies that this line is an MX record. The number after the MX indicates a priority level for that entry. Lower numbers mean higher priority. In this example, sendmail will try to communicate with mailhub first. If it cannot successfully communicate with mailhub, it will then try mailhub2.

CNAME—Canonical Name

The CNAME record makes it possible to alias hostnames via DNS. This is useful for giving common names to servers. For example, we are used to Web servers having the hostname www, as in www.domain.com. However, you might not want to name the Web server this at all. On many sites, the machines have a theme to the naming of hosts and placing www in the middle of that might appear awkward.

To use a CNAME, you must have another record such as an A or MX record for that host that specifies its real name—for example,


toybox    IN A        192.168.42.59

www       IN CNAME    toybox

In this example, toybox is the real name of the server and www is its alias.

RP and TXT—The Documentation Entries

It is often useful to provide contact information as part of your database—not just as comments, but as actual records that can be queried by others. This can be accomplished by using the RP and TXT records.

TXT records are a free form text entry that allow you to place whatever information you deem fit. Most often, you will only want to give contact information. Each TXT record must be tied to a particular hostname—for example,


domain.com.    IN TXT "Contact: Heidi S."

               IN TXT "Systems Administrator/"

               IN TXT "            Ring Master"

               IN TXT "Voice: (800) 555-1212"

Previous | Table of Contents | Next