Tuesday, January 24, 2012

DNS TTL Cheat Sheet

When migrating a DNS from an old server to a new server I lower the TTL 24 hours before so that when I make the change external users get the new site within an hour instead of the old site because the DNS information is cached for 24 hours.

When lowering the TTL I end up having to ask someone or look it up enough that I'm posting this cheat sheet for myself to search in the future. So if a longer TTL is inherited from the top of the zone file and foo.tld inherits that time it would look like the following:

foo                        A       123.456.7.8
To lower it's TTL to one hour I simply insert the time with units (else it's seconds) in between the hostname and the A:
foo        1h              A       123.456.7.8
Then after reloading the zone file query that DNS server for the name:
dig @123.456.2.1 foo.bar.com
and make sure the ANSWER section contains 3600, which is the number of seconds in an hour:
;; ANSWER SECTION:
foo.tld. 3600    IN      A       123.456.7.8

No comments: