Skip to content

Backgrounds

How-to Guides

Technical References

Check DNS record Time to Live

These instructions will demonstrate how to determine a DNS record’s Time to Live value using common command line tools.

Time to Live (TTL) is a value associated with a DNS record that tells other servers how long to cache the DNS record. Longer TTLs mean that DNS resolvers cache the data longer, and it can take longer for changes to propagate to various DNS servers across the globe.

Because lowering a long TTL in the DNS record does not immediately purge cached values in other nameservers, it’s important to check (and lower, if necessary) this setting well in advance of any changes, including a site launch. And verify it again on the morning of launch.

The best way to verify this is to check with your DNS provider directly, but this method provides an independent verification by querying the DNS.

Checking the current TTL

This example is for our domain docs.wpvip.com.

  1. Determine the root of the domain, which is normally just the last two parts, e.g. the root of wpvip.com is wpvip.com, and the root of docs.wpvip.com is wpvip.com. However, there are some top level domains that use two segments, such as .co.uk, and so for example.co.uk and http://www.example.co.uk, the root is example.co.uk.
  2. In a shell or terminal window, run dig using the domain root (wpvip.com), to identify the authoritative nameserver:
$ dig +nssearch wpvip.com
SOA ns1.wordpress.com. hostmaster.wordpress.com. 2005071858 14400 7200 604800 300 from server 198.181.116.9 in 22 ms.
SOA ns1.wordpress.com. hostmaster.wordpress.com. 2005071858 14400 7200 604800 300 from server 198.181.117.9 in 22 ms.
SOA ns1.wordpress.com. hostmaster.wordpress.com. 2005071858 14400 7200 604800 300 from server 192.0.74.9 in 22 ms.
  1. From the output, the first line starting with SOA shows the nameserver, which often starts with NS1 (but not always) e.g. ns1.wordpress.com
  2. In a shell or terminal window, run dig again (in this case, explicitly requesting the info from the authoritative nameserver) to get the full domain’s (docs.wpvip.com) entry and current TTL from the authoritative server:
$ dig @ns1.wordpress.com +noall +answer docs.wpvip.com
docs.wpvip.com.		14400	IN	CNAME	wpvip.com.
wpvip.com.		3600	IN	A	192.0.66.32

Since the entry for docs.wpvip.com is a CNAME, the output also includes the record for the target, which is the root domain, wpvip.com.

The number next to the full domain, in this case 14400, is the TTL for that record in seconds.

In the example above, the TTL of 14400 means that any changes – to the TTL or the CNAME or A record of the docs.wpvip.com domain – may take 4 hours to propagate to other nameservers.

Reducing the TTL of a DNS record to 300 seconds at least a day before launch means that when the IP / CNAME / A record is changed at launch time, propagation will be quicker and most browsers will be directed to the newly launched site within a few minutes of launch.

Last updated: April 09, 2021