Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

On a linux server, how do you find out how long the DNS cache expiry time is?


share|improve this question
up vote 8 down vote accepted

Use dig to query for the hostname in question.

$ dig +ttlid

; <<>> DiG 9.6.0-APPLE-P2 <<>> +ttlid ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 47938 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0



;; Query time: 27 msec ;; SERVER: ;; WHEN: Mon Sep 6 23:58:09 2010 ;; MSG SIZE rcvd: 44

In the case above, the TTL is 3550.

In a normal DNS server, this is usually configured at the zone level, in the SOA line. That's where you specify the default TTL for the domain. But it can also be set for a hostname specifically, with a syntax similar to the output of dig above.

share|improve this answer
We might be talking at cross-purposes here. I want to know how long a local server takes between doing a DNS lookup for any given target. – Chris Sep 7 '10 at 23:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.