Blog

OS X Server DNS TTL

For some reasons, you may want to modify the TTL (Time to Live) of a DNS Server.

The default TTL is 10800 seconds (3 hours).  To modify the TTL, edit the following file on your OS X DNS Server and replace $TTL 10800 with the $TTL value you desire.  Please note using a TTL value of 0 (zero) is not supported by some systems and is not advised.

The DNS cache on the client systems may need to be flushed to honor the new TTL.  This is done on OS X by using the “dscacheutil -flush” command.

vi /var/named/zones/db.cloudmac.net.zone.apple

Here is an example config file:

dns1:~ root# cat /var/named/zones/db.cloudmac.net.zone.apple
 ;GUID=D521C96D-AA85-4438-A1BC-8B1D7987DCD0
 ;selfResolvingHostname=0

$TTL 300
cloudmac.net. IN SOA dns.cloudmac.net. netopps.cloudmac.net. (
     2011112804    ;Serial
     86400         ;Refresh
     3600          ;Retry
     604800        ;Expire
     345600        ;Negative caching TTL
 ) 

cloudmac.net. IN  NS dns.cloudmac.net.
dns1 IN  A 10.22.100.30
mail IN  A 10.22.100.31
cloudmac.net. IN  MX 0 mail.cloudmac.net.
dns1:~ root#

Run the dig command to confirm the TTL information reflects what you entered:

dns1:~ root# dig mail.cloudmac.net @10.22.100.30

; <<>> DiG 9.6-ESV-R4-P3 <<>> mail.cloudmac.net @10.22.100.30
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 983
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1

;; QUESTION SECTION:
;mail.cloudmac.net.        IN    A

;; ANSWER SECTION:
mail.cloudmac.net.    300    IN    A    10.22.100.31

;; AUTHORITY SECTION:
cloudmac.net.        300    IN    NS    dns1.cloudmac.net.

;; ADDITIONAL SECTION:
dns1.cloudmac.net.    300    IN    A    10.22.100.30

;; Query time: 1 msec
;; SERVER: 10.22.100.30#53(10.22.100.30)
;; WHEN: Mon Nov 28 16:47:32 2011
;; MSG SIZE  rcvd: 85

dns1:~ root#


More info is available by following the links below:

Time to live (TTL) – Wikipedia.com

DNS Round Robin – Wikipedia.com

dscacheutil – developer.apple.com