I would like to see the Time-To-Live (TTL) value for a CNAME record.
I have access to dig (on Apple Mac OS X), which gives me an answer like this:
% dig host.example.gov
<*SNIP*>
;; ANSWER SECTION:
host.example.gov. 43200 IN CNAME host1.example.gov.
host1.example.gov. 43200 IN A 192.168.16.10
Is the value '43200' the TTL for this DNS record?
Best Answer
Yes, the number there is the number of seconds left until that record expires (providing we're not querying the authoritative nameserver). Obviously with a CNAME there's a level of redirection, so the TTL for the A record it points to in this case may be important as well.
If you wait a couple of seconds and run dig again on your local nameserver, you should see that TTL number decrease by the number of seconds you waited (approximately). When it hits 0, it'll refresh or if your nameserver refreshes the zone for some reason.
As mentioned above, there is a difference between dig being run against a nameserver with a cached entry and the nameserver that is authoritative for that entry.
(in the examples I use below I use the
+noauthority
+noquestion
&+nostats
flags just to keep the output terse).Note the difference between the following queries:
So in the above query, we're querying a nameserver that is authoritative for stackoverflow.com. If you notice the
flags
section, pay special attention to the aa flag which denotes this is an authoritative answer (i.e. not cached).In the above query, we don't have an aa flag, and the TTL will keep decreasing as we query and query. This is essentially the counter I was talking about previously.