The Database File

A database file or "zone file" is the file which contains the resource records for that part of the domain for which the zone is responsible. Some of the common resource records are given below. For a more complete list, look in the Appendix of this document or refer to the appropriate RFCs. Windows NT 4.0 supplies a file as a template to work with called "place.dns." This file should be edited and renamed before you use it on a production DNS server. It is generally a good idea to name this file the same as the zone it represents. This is the file that will be replicated between masters and secondaries.

The Start of Authority

The first record in any database file is the SOA Record.

IN SOA <source host> <contact e-mail> <ser. no.> <refresh time> <retry time> <expiration time> <TTL>

Instead of writing the "@" symbol in the e-mail name as would normally be done, the "@" must be replaced with a "." when placed in the zone files. In other words, the e-mail address glennwo@microsoft.com would be represented as glennwo.microsoft.com in the zone file.


In order for a resource record to span a line in a database file, parentheses must enclose the line breaks.

In a zone file, the "@" symbol represents the root domain of the zone (microsoft.com in the following examples). The "IN" in the following records is the class of data. It stands for Internet. Other classes exist, but none of them are currently in widespread use.


Any domain name in the database file which is not terminated with a period "." will have the root domain appended to the end.


Example:

@ IN SOA nameserver1.microsoft.com. glennwo.microsoft.com. (

1 ; serial number

10800 ; refresh [3 hours]

3600 ; retry [1hour]

604800 ; expire [7 days]

86400 ) ; time to live [1 day]

Setting the servers refresh interval is a balance between data consistency (accuracy of your data) and your networks load.

The Name Server Record

Lists the name servers for this domain allowing other name servers to lookup names in your domain.

<domain> IN NS <nameserver host >

Example:

@ IN NS nameserver2.microsoft.com.

@ IN NS nameserver3.microsoft.com.

The Mail Exchange Record

This record tells us what host processes mail for this domain. If multiple mail exchange records exist, the resolver will attempt to contact the mail servers in order of preference from lowest value (highest priority) to highest value (lowest priority). By using the example records that follow, mail addressed to scottsu@microsoft.com is delivered to scottsu@mailserver0.microsoft.com first if possible and then to scottsu@mailserver1.microsoft.com if mailserver0 is unavailable.

<domain> IN MX <preference> <mailserver host >

Example:

@ IN MX 1 mailserver0

@ IN MX 2 mailserver1

The Host Record

A host record is used to statically associate hosts names to IP addresses within a zone. It should contain entries for all hosts which require static mappings including workstations, name servers, mail servers, etc. These are the records which make up most of the database file when static records are used.

<host name> IN A <ip address of host>

Example:

rhino IN A 157.55.200.143

nameserver2 IN A 157.55.200.2

mailserver1 IN A 157.55.200.51

The Local Host Record

A local host record allows lookups for "localhost.microsoft.com." to return 127.0.0.1.

localhost IN A 127.0.0.1

The CNAME Record

These records are sometimes called "aliases" but are technically referred to as "Canonical Name" (CNAME) entries. These records allow you to use more than one name to point to a single host.

Using canonical names makes it easy to do such things as host both an FTP server and a Web server on the same machine.

<host alias name> IN CNAME <host name>

Example:

Assume that www.microsoft.com and FTP.microsoft.com are on the same machine. If this is the case then you might have the following entries in your zone file:

FileServer1 IN A 157.55.200.41

FTP CNAME FileServer1

www CNAME FileServer1

If you ever intend on moving the FTP server service away from the Web service, then all you have to do is change the CNAME in the DNS server for FTP and add an address record for the new server. For example:

FTP CNAME FileServer2

FileServer2 IN A 157.55.200.42