-->
Previous Table of Contents Next


A second primary line in the named.hosts file shows that you also have primary zone authority for the zone 197.198.199.in-addr.arpa with zone information in the named.rev file. This strange syntax is named’s way of getting information to match IP addresses to DNS names. Because DNS was originally set up to match DNS names to IP addresses, a different primary line is needed to do reverse resolution.


NOTE:  The in-addr.arpa domain is used to specify reverse, or IP address, to DNS name resolution.

Database Files and Resource Records

All information in the various named database files is stored in a format known as a resource record. Each resource record has a type associated with it, which tells the record’s function. A resource record is the smallest piece of information that named uses.

Most people find the syntax for resource records and master database files in general to be a bit arcane and obscure. It doesn’t help matters that some resource records have to appear in certain places in certain files. Most DNS configuration problems can be traced to errors in these master configuration files. All this said, it’s time to dive in and look at the resource record syntax and the various master files.


NOTE:  Within the master configuration files, you have the option of specifying absolute host names or host names relative to this domain. Host names are considered absolute if they end in a dot character (.), as in foo, tristar, com.. Host names that don’t end with a dot are considered relative to the local domain, also known as the origin. You can refer to the origin itself by using the @ character.

Resource records use a general syntax that’s consistent across all types of resource records. To add to the confusion, however, several parts of the record are optional depending on the record type, and may assume a default value if not specified. The basic format of a resource record is


[owner ] [ttl ] [class ] type data

Fields are separated by white space such as spaces or tabs. Table 25.5 discusses what the various fields mean.

Table 25.5 Fields in the Resource Record Data Format

Field Description

owner The domain or host name that the record applies to. If no name is given, the domain name of the previous resource record is assumed.
ttl The time-to-live field, which tells how long, in seconds, the information in this record is valid after it’s retrieved from a DNS server. If no ttl value is given, the minimum ttl of the last Start of Authority (SOA) record is used.
class Specifies a networking address class. For TCP/IP networks, use the value IN. If the class isn’t given, the class of the previous resource record is used.
type Lists the type of the resource record. This value is required. The various resource record types are listed in the next section.
data Specifies the data associated with this resource record. This value is required. The format of the data field depends on the content of the type field.

As you can see, the format of a resource record can get quite confusing. There are several optional fields, and the data field depends on the type of the resource record. To make matters worse, there are several different types of resource records. Table 25.6 lists the most common resource record types; a few additional types are rarely used. If you’re interested in the additional types, refer to the appropriate RFCs and the man pages for named.

Table 25.6 Commonly Used Resource Record Types

Type Description

A An address record that associates a host name with an address. The data field holds the address in dotted decimal format. There can be only one A record for any given host, as this record is considered authoritative information. Any additional host name or address mappings for this host must be given by using the CNAME type.
CNAME Associates an alias for a host with its canonical name, the name specified in the A record for this host.
HINFO Provides information about a host. The data field holds the hardware and software information for a particular host. It’s just a free-format text string, so you can put in whatever makes sense for your hardware.
MX Sets up a mail exchanger record. The data field holds an integer preference value followed by a host name. MX records tell a mail transport to send mail to another system that knows how to deliver it to its final destination.
NS Points to a name server for another zone. The data field of the NS resource record contains the DNS name of the name server. You need to specify an A record as well to match the host name with the address of the name server.
PTR Maps addresses to names, as in the in-addr.arpa domain. The host name must be the canonical host name.
SOA Tells the name server that all the resource records following it are authoritative for this domain. (SOA stands for start of authority.) The data field is enclosed by parentheses and is typically a multiline field. The data field of the SOA record contains the following entries:
origin—The canonical name of the primary name server for this domain. It’s usually given as an absolute domain name ending with a. (dot), so it’s not modified by the named daemon.
contact—The e-mail contact of the person who’s responsible for maintaining this domain. Because the @ character has special meaning in resource records, it’s replaced by a. (dot). If the responsible person for maintaining zone information about tristar.com is Dave, the contact address is dave.tristar.com.
serial—The version number of the zone information file, which is given as an integer. It’s used by secondary name servers to determine when the zone information file has changed. You should increment this number by 1 every time you change the information file.
refresh—The length of time in seconds that a secondary server should wait before trying to check the SOA record of the primary name server. The SOA records don’t change very often, so you can usually set this value to be on the order of one day or so.
retry—The time in seconds that a secondary server waits to retry a request to a primary server if the primary server wasn’t available. Typically, it should be on the order of a few minutes.
expire—The time in seconds that the secondary server should wait before throwing away the zone information if it has been unable to contact the primary server. This number should typically be very large, on the order of 30 days or so.
minimum—The default ttl value for resource records that don’t specify a ttl. If your network doesn’t change very much, this number can be set to a fairly large value, such as a couple of weeks. You can always override it by specifying a ttl value in your resource records.


Previous Table of Contents Next