Resource Records in Zone Files
A resource record in a zone file contains the following fields, some of which are optional, depending on the record type:
- Name
-
Domain name or IP address.
- TTL (time to live)
-
The maximum time that a name server caches a record before it checks whether a newer one is available.
- Class
-
Always
IN
for the Internet. - Type
-
Type of record, for example:
A
(address)-
IPv4 address corresponding to a host.
AAAA
(address)-
IPv6 address corresponding to a host.
CNAME
(canonical name)-
Alias name corresponding to a host name.
MX
(mail exchange)-
Destination for email addressed to the domain.
NS
(name server)-
Fully qualified domain name of an authoritative name server for a domain.
PTR
(pointer)-
Host name that corresponds to an IP address for address-to-name lookups (reverse-name resolution).
SOA
(start of authority)-
Authoritative information about a zone, such as the primary name server, the email address of the domain's administrator, and the domain's serial number. All records following a
SOA
record relate to the zone that it defines up to the nextSOA
record.
- Data
-
Information that the record stores, such as an IP address in an
A
record, or a host name in aCNAME
orPTR
record.
The following example shows the contents of a typical zone file such as /var/named/master-data
:
$TTL 86400 ; 1 day
@ IN SOA dns.us.example.com. root.us.example.com. (
57 ; serial
28800 ; refresh (8 hours)
7200 ; retry (2 hours)
2419200 ; expire (4 weeks)
86400 ; minimum (1 day)
)
IN NS dns.us.example.com.
dns IN A 192.168.2.1
us.example.com IN A 192.168.2.1
svr01 IN A 192.168.2.2
www IN CNAME svr01
host01 IN A 192.168.2.101
host02 IN A 192.168.2.102
host03 IN A 192.168.2.103
...
A comment on a line is preceded by a semicolon (;
).
The $TTL
directive defines the default time-to-live value for all resource records in the zone. Each resource record can define its own time-to-live value, which overrides the global setting.
The SOA
record is mandatory and includes the following information:
-
us.example.com
-
The name of the domain.
-
dns.us.example.com.
-
The fully qualified domain name of the name server, including a trailing period (
.
) for the root domain. -
root.us.example.com.
-
The email address of the domain administrator.
- serial
-
A counter that, if incremented, tells
named
to reload the zone file. - refresh
-
The time after which a primary name server notifies backup name servers that they should refresh their database.
- retry
-
If a refresh fails, the time that a backup name server should wait before attempting another refresh.
- expire
-
The maximum elapsed time that a backup name server has to complete a refresh before its zone records are no longer considered authoritative and it will stop answering queries.
- minimum
-
The minimum time for which other servers should cache information obtained from this zone.
An NS
record declares an authoritative name server for the domain.
Each A
record specifies the IP address that corresponds to a host name in the domain.
The CNAME
record creates the alias www
for svr01
.
For more information, see the BIND 9 Administrator Reference Manual.