< Day Day Up > |
Your name server holds domain name information about the hosts on your network in resource records placed in zone and reverse mapping files. Resource records are used to associate IP addresses with fully qualified domain names. You need a record for every computer in the zone that the name server services. A record takes up one line, though you can use parentheses to use several lines for a record, as is usually the case with SOA records. A resource record uses the Standard Resource Record Format as shown here:
name [<ttl>] [<class>] <type> <rdata> [<comment>]
Here, name is the name for this record. It can be a domain name or a hostname (fully qualified domain name). If you specify only the hostname, the default domain is appended. If no name entry exists, the last specific name is used. If the @ symbol is used, the name server's domain name is used. ttl (time to live) is an optional entry that specifies how long the record is to be cached. class is the class of the record. The class used in most resource record entries is IN, for Internet. By default, it is the same as that specified for the domain in the named.conf file. type is the type of the record. rdata is the resource record data. The following is an example of a resource record entry. The name is rabbit.mytrek.com, the class is Internet (IN), the type is a host address record (A), and the data is the IP address 192.168.0.2.
rabbit.mytrek.com. IN A 192.168.0.2
Different types of resource records exist for different kinds of hosts and name server operations (see Table 34-8 for a listing of resource record types). A, NS, MX, PTR, and CNAME are the types commonly used. A is used for host address records that match domain names with IP addresses. NS is used to reference a name server. MX specifies the host address of the mail server that services this zone. The name server has mail messages sent to that host. The PTR type is used for records that point to other resource records and is used for reverse mapping. CNAME is used to identify an alias for a host on your system.
Type |
Description |
---|---|
A |
An IPv4 host address, maps hostname to IPv4 address |
A6 |
An IPv6 host address |
NS |
Authoritative name server for this zone |
CNAME |
Canonical name, used to define an alias for a hostname |
SOA |
Start of Authority, starts DNS entries in zone file, specifies name server for domain, and other features such as server contact and serial number |
WKS |
Well-known service description |
PTR |
Pointer record, for performing reverse domain name lookups, maps IP address to hostname |
RP |
Text string that contains contact information about a host |
HINFO |
Host information |
MINFO |
Mailbox or mail list information |
MX |
Mail exchanger, informs remote site of your zone's mail server |
TXT |
Text strings, usually information about a host |
KEY |
Domain private key |
SIG |
Resource record signature |
NXT |
Next resource record |
A zone or reverse mapping file always begins with a special resource record called the Start of Authority (SOA) record. This record specifies that all the following records are authoritative for this domain. It also holds information about the name server's domain, which is to be given to other name servers. An SOA record has the same format as other resource records, though its data segment is arranged differently. The format for an SOA record follows:
name {ttl} class SOA Origin Person-in-charge ( Serial number Refresh Retry Expire Minimum )
Each zone has its own SOA record. The SOA begins with the zone name specified in the named.conf zone entry. This is usually a domain name. An @ symbol is usually used for the name and acts like a macro expanding to the domain name. The class is usually the Internet class, IN. SOA is the type. Origin is the machine that is the origin of the records, usually the machine running your name server daemon. The person-in-charge is the e-mail address for the person managing the name server (use dots, not @, for the e-mail address, as this symbol is used for the domain name). Several configuration entries are placed in a block delimited with braces. The first is the serial number. You change the serial number when you add or change records, so that it is updated by other servers. The serial number can be any number, as long as it is incremented each time a change is made to any record in the zone. A common practice is to use the year-month-day-number for the serial number, where number is the number of changes in that day. For example, 1999120403 would be the year 1999, December 4, for the third change. Be sure to update it when making changes.
Refresh specifies the time interval for refreshing SOA information. Retry is the frequency for trying to contact an authoritative server. Expire is the length of time a secondary name server keeps information about a zone without updating it. Minimum is the length of time records in a zone live. The times are specified in the number of seconds.
The following example shows an SOA record. The machine running the name server is turtle.mytrek.com, and the e-mail address of the person responsible for the server is hostmaster.turtle.mytrek.com. Notice the periods at the ends of these names. For names with no periods, the domain name is appended. turtle would be the same as turtle.mytrek.com. When entering full hostnames, be sure to add the period so that the domain is not appended.
@ IN SOA turtle.mytrek.com. hostmaster.turtle.mytrek.com. ( 1997022700 ; Serial 28800 ; Refresh 14400 ; Retry 3600000 ; Expire 86400 ) ; Minimum
The name server record specifies the name of the name server for this zone. These have a resource record type of NS. If you have more than one name server, list them in NS records. These records usually follow the SOA record. As they usually apply to the same domain as the SOA record, their name field is often left blank to inherit the server's domain name specified by the @ symbol in the previous SOA record.
IN NS turtle.mytrek.com.
You can, if you wish, enter the domain name explicitly as shown here:
mytrek.com. IN NS turtle.mytrek.com.
Resource records of type A are address records that associate a fully qualified domain name with an IP address. Often, only their hostname is specified. Any domain names without a terminating period automatically have the domain appended to them. Given the domain mytrek.com, the turtle name in the following example is expanded to turtle.mytrek.com:
rabbit.mytrek.com. IN A 192.168.0.2 turtle IN A 192.168.0.1
BIND versions 8.2.2 and 9.1 support IPv6 addresses. IPv6 IP addresses have a very different format from that of the IPv4 addresses commonly used (see Chapter 38). Instead of the numerals arranged in four segments, IPv6 uses hexadecimal numbers arranged in seven segments. In the following example, turtle.mytrek.com is associated with a site-local IPv6 address: fec0::. Recall that there are only three fields in a site-local address: format prefix, sub-net identifier, and interface identifier. The empty segments of the sub-net identifier can be represented by an empty colon pair (::). The interface identifier 8:800:200C:417A follows.
turtle.mytrek.com. IN A6 FEC0::8:800:200C:417A
IPv6 also supports the use of IPv4 addresses as an interface identifier, instead of the MAC-derived identifier. The network information part of the IPv6 address would use IPv6 notation and the remaining interface (host) identifier would use the full IPv4 address. These are known as mixed addresses. In the next example, lizard.mytrek.com is given a mixed address using IPv6 network information and IPv4 interface information. The IPv6 network information is for an IPv6 site-local address.
lizard.mytrek.com. IN A6 fec0::192.168.0.3
The AAAA record is an older and deprecated version of an IPv6 record. It is still in use in many networks. An AAAA record operates much like a standard A address record, requiring a full IPv6 address. You can do the same with an A6 record. An A6 record, though, can be more flexible, in that it does not require a full address. Instead, you chain A6 records together letting you specify just part of the address in each. For example, you could specify just an interface identifier for a host, letting the network provide information by another IPv6 record. In the next example, the first A6 record lists only the address for the interface identifier for the host divit. Following the address is the domain name, mytrek.com, whose address is to be used to complete divit's address, providing network information. The next A6 record provides the network address information for mytrek.com.
divit.mygolf.com. IN A6 0:0:0:0:1234:5678:3466:af1f mytrek.com. mytrek.com. IN A6 3ffe:8050:201:1860::
The Mail Exchanger record, MX, specifies the mail server that is used for this zone or for a particular host. The mail exchanger is the server to which mail for the host is sent. In the following example, the mail server is specified as turtle.mytrek.com. Any mail sent to the address for any machines in that zone will be sent to the mail server, which in turn will send it to the specific machines. For example, mail sent to a user on rabbit.mytrek.com will first be sent to turtle.mytrek.com, which will then send it on to rabbit.mytrek.com. In the following example, the host 192.168.0.1 (turtle.mytrek.com) is defined as the mail server for the mytrek.com domain:
mytrek.com. IN MX 10 turtle.mytrek.com.
You could also inherit the domain name from the SOA record, leaving the domain name entry blank.
IN MX turtle.mytrek.com.
You could use the IP address instead, but in larger networks, the domain name may be needed to search for and resolve the IP address of a particular machine, which could change.
mytrek.com. IN MX 10 192.168.0.1
An MX record recognizes an additional field that specifies the ranking for a mail exchanger. If your zone has several mail servers, you can assign them different rankings in their MX records. The smaller number has a higher ranking. This way, if mail cannot reach the first mail server, it can be routed to an alternate server to reach the host. In the following example, mail for hosts on the mytrek.com domain is first routed to the mail server at 192.168.0.1 (turtle.mytrek.com), and if that fails, it is routed to the mail server at 192.168.0.2 (rabbit.mytrek.com).
mytrek.com. IN MX 10 turtle.mytrek.com. IN MX 20 rabbit.mytrek.com.
You can also specify a mail server for a particular host. In the following example, the mail server for lizard.mytrek.com is specified as rabbit.mytrek.com:
lizard.mytrek.com. IN A 192.168.0.3 IN MX 10 rabbit.mytrek.com.
Resource records of type CNAME are used to specify alias names for a host in the zone. Aliases are often used for machines running several different types of servers, such as both Web and FTP servers. They are also used to locate a host when it changes its name. The old name becomes an alias for the new name. In the following example, ftp.mytrek.com is an alias for a machine actually called turtle.mytrek.com:
ftp.mytrek.com. IN CNAME turtle.mytrek.com.
The term CNAME stands for canonical name. The canonical name is the actual name of the host. In the preceding example, the canonical name is turtle.mytrek.com. The alias, also known as the CNAME, is ftp.mytrek.com. In a CNAME entry, the alias points to the canonical name. Aliases cannot be used for NS (name server) or MX (mail server) entries. For those records, you need to use the original domain name or IP address.
A more stable way to implement aliases is simply to create another address record for a host or domain. You can have as many hostnames for the same IP address as you want, provided they are certified. For example, to make www.mytrek.com an alias for turtle.mytrek.com, you only have to add another address record for it, giving it the same IP address as turtle.mytrek.com.
turtle.mytrek.com. IN A 192.168.0.1 www.mytrek.com. IN A 192.168.0.1
A PTR record is used to perform reverse mapping from an IP address to a host. PTR records are used in the reverse mapping files. The name entry holds a reversed IP address, and the data entry holds the name of the host. The following example maps the IP address 192.168.0.1 to turtle.mytrek.com:
1.1.168.192 IN PTR turtle.mytrek.com.
In a PTR record, you can specify just that last number segment of the address (the host address) and let DNS fill in the domain part of the address. In the next example, 1 has the domain address, 1.168.192, automatically added to give 1.1.168.192:
1 IN PTR turtle.mytrek.com.
The HINFO, RP, MINFO, and TXT records are used to provide information about the host. The RP record enables you to specify the person responsible for a certain host. The HINFO record provides basic hardware and operating system identification. The TXT record is used to enter any text you want. MINFO provides a host's mail and mailbox information. These are used sparingly, as they may give too much information out about the server.
< Day Day Up > |
This HTML Help has been published using the chm2web software. |