Checking Domain TTL Values

Part of the process of putting a new site live can be moving DNS entries around. Prior to doing this it's a really good idea to sort out the Time To Live (TTL) of the DNS record so that when you do change DNS entries you aren't waiting around for a day for the DNS to sort itself out. Most DNS registrars will allow you to set your TTL down to a minute or so.

It's also very important to check the status of your DNS records to ensure that they have the correct TTL, usually a day before (and day of) the move.

You can check the TTL value of your A record with the host command. Change the value of the -t (type) flag to aaaa or cname to inspect different types of records.

host -a -t a www.hashbangcode.com

This will produce the following output. The TTL of the domain below is '125'.

Trying "www.hashbangcode.com"
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 42916
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;www.hashbangcode.com.		IN	A

;; ANSWER SECTION:
www.hashbangcode.com.	125	IN	A	104.31.77.1
www.hashbangcode.com.	125	IN	A	104.31.76.1

Received 70 bytes from 10.0.0.4#53 in 4 ms

It's also possible to check the same result with dig using the command.

dig +nocmd +noall +answer +ttlid www.hashbangcode.com

This produces the following result. The TTL value for the domain is '91'.

www.hashbangcode.com.	91	IN	A	104.31.76.1
www.hashbangcode.com.	91	IN	A	104.31.77.1

If you are worried that the response has been cached up stream (which is how DNS works and why you need to lower the TTL in the first palce) you can directly interrogate the DNS name server for a response. This is done using the whois command.

whois hashbangcode.com

This will tell you a lot about the domain name. The important bit of information is called Name Server. Different TLD providers will produce different whois ouputs, but the information will be in there somewhere.

For my own site the name server entries looked like this.

Name Server: ernest.ns.cloudflare.com
Name Server: lorna.ns.cloudflare.com

With this information in hand you can directly interrogate the DNS server using the following.

dig +nocmd +noall +answer @ernest.ns.cloudflare.com www.hashbangcode.com

This is perhaps the most reliable way to test your domain TTL values as it cuts out any caching of results.

Finally, always remember to check all domains and sub-domains you are migrating. This especially means checking the www and non-www variants of every address you are migrating.

Add new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
17 + 0 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.