The second part of configuring a DNS server is the zone files. These are the files that contain the list of all the hosts in your domain, and their corresponding IP address.
First, there's a number of DNS records that needs a little explanation.
There's many other types of records, but these are the most commonly used records.
A zone file contains two parts. First, the SOA section, and then the list of DNS records. A typical zone file will look something like this:
$TTL 86400
@ IN SOA mailer.hansenonline.net. hostmaster.hansenonline.net.(
2003060919; serial
21600; refresh every 6 hours
3600; retry after one hour
604800; expire after a week
86400 ); minimum TTL of 1 day
IN NS mailer.hansenonline.net.
IN MX 10 mailer.hansenonline.net.
mailer IN A 192.168.33.11 firewall IN A 192.168.33.1 switch IN A 192.168.33.3 replaytv IN A 192.168.33.200 cisco IN CNAME switch www IN CNAME mailer mrtg IN CNAME mailer
The SOA record might be a little tricky. First, it lists the name server for the domain, and next the e-mail address of the administer of the domain (note that the @ has been replaced by a period). The serial number doesn't have to be a date, however, whenever a change to the zone file on the master DNS server is changed, the serial number must be increased by some value. That way, any slave server(s) will know that an update has been made, and they'll do a zone transfer to get the newest copy of the zone file. The other numbers are explained in the file itself, and the numbers I have here are the default values... The next record is the name server record. Here, it simply refers to itself as the name server, however, if you have several servers for a domain (one master, and at least one slave), you should put in an entry for each name server.
The MX record also points to the same server. If you have more than one mail server, you can add several MX records. The value is for priority; the lower the number, the higher the priority. A secondary mail server should therefore have a higher value (i.e. 20).
Next are all the A records in no specific order. If you have many hosts, you may want to put them in alphabetically or numerically, whichever works for you... And, at the end, I have the CNAME records. Since my "mailer" server is also my web server, I needed the "www" to point to the same IP address as "mailer".
And, now, the reverse zone file with all the PTR records. This is really handy of you need to look up a host name when you know the IP address.
$TTL 86400
@ IN SOA mailer.hansenonline.net. hostmaster.hansenonline.net.(
0306190719 ; serial
21600 ; refresh after 6 hours
3600 ; retry in 1 hour
604800 ; expire after a week
86400 ) ; minimum TTL of one day
IN NS mailer.hansenonline.net.
1 IN PTR firewall.hansenonline.net.
3 IN PTR switch.hansenonline.net.
11 IN PTR mailer.hansenonline.net.
200 IN PTR replaytv.hansenonline.net.
There isn't much difference in how the zone file looks, except that it contains only the SOA record and PTR records. The IP address range has been specified in the configuration file, so only the last octet is listed in the zone file...
See also the bind page for configuration information.
© 1999-2005 Lars M. Hansen