Tuesday, June 9, 2009

Sample Forward Zone File


Now that you know the key elements of a zone file, it's time to examine a working example for the domain my-site.com.

;
; Zone file for my-site.com
;
; The full zone file
;
$TTL 3D
@ IN SOA ns1.my-site.com. hostmaster.my-site.com. (
200211152 ; serial#
3600 ; refresh, seconds
3600 ; retry, seconds
3600 ; expire, seconds
3600 ) ; minimum, seconds

NS www ; Inet Address of nameserver
my-site.com. MX 10 mail ; Primary Mail Exchanger

localhost A 127.0.0.1
bigboy A 97.158.253.26
mail A 97.158.253.27
ns1 CNAME bigboy
www CNAME bigboy

Notice that in this example:

  • Server ns1.my-site.com is the name server for my-site.com. In corporate environments there may be a separate name server for this purpose. Primary name servers are more commonly called ns1 and secondary name servers ns2.
  • The minimum TTL value ($TTL) is three days, therefore remote DNS caching servers will store learned DNS information from your zone for three days before flushing it out of their caches.
  • The MX record for my-site.com points to the server named mail.my-site.com and this server has the IP address 97.158.253.27.
  • ns1 is actually a CNAME or alias for the Web server www. So here you have an example of the name server, and Web server being the same machine. If they were all different machines, then you'd have an A record entry for each.
www                 A          97.158.253.26
ns A 97.158.253.125

It is a required practice to increment your serial number whenever you edit your zone file. When DNS is setup in a redundant configuration, the slave DNS servers periodically poll the master server for updated zone file information, and use the serial number to determine whether the data on the master has been updated. Failing to increment the serial number, even though the contents of the zone file have been modified, could cause your slaves to have outdated information.

Note: The DNS specification (RFC 2181) does not allow for an MX record to be a CNAME. It may work in most cases, but some mail servers may refuse to send to you because of this.

No comments:

Post a Comment