Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

I'm wondering if there is a way to query a DNS server and bypass caching (with dig). Often I change a zone on the DNS server and I want to check if it resolves correctly from my workstation. But since the server caches resolved requests, I often get the old ones. Restarting or -loading the server is not really something nice.

share|improve this question
up vote 49 down vote accepted

You can use the @ syntax to look up the domain from a particular server. If the DNS server is authoritative for that domain, the response will not be a cached result.


You can find the authoritative servers by asking for the NS records for a domain:

dig NS
share|improve this answer
Oh okay. Yeah I was familiar with the @ syntax, but haven't had the idea to query the authoritative server instead. Thanks! – Daniel Mar 21 '12 at 17:22
Side note: in cases where you're trying to see what responses a caching server would get, +norecurse is recommended. +recurse is on by default will occasionally change the way a DNS server interprets your question entirely. – Andrew B Mar 1 '13 at 4:37
What if you're waiting for the authoritative servers to change? – Kasper Souren Aug 5 '14 at 12:12
@KasperSouren Are you talking about the NS records at the authoritative servers or the glue records at the parent? You can find the parent with +trace but beware of caching. Andrew B wrote up a good explanation of how caching can trick you when waiting for nameservers to change. – Ladadadada Aug 7 '14 at 6:46

Edit: Now I know more about DNS, I can tell you the following isn't a very good answer. The real answer is you can't, not reliably. Dig just passes your query on to whichever nameservers you have listed, using DNS request. There is no standard way for a DNS request to say "don't use your cache". There is a way to tell it "don't use recursion" but this doesn't specifically request not using the cache, and a nameserver would still be acting reasonably if it responded non-authoritatively with an answer from its cache.

If you wanted to stop a nameserver from responding from its cache, you'd have to do achieve this on the nameserver, if it's one you control, not to Dig.

You can still however get Dig to simulate what a recursive nameserver would do, bypassing the usual upstream nameserver, with options like +trace.

I'd do it by adding the +norecurse or +trace option. These disable the use of recursive DNS which is what allows non-authoritative caches, and forces going to the authoritative servers.

dig +norecurse


dig +trace

The added benefit of using +trace is that you get to see all of the separate requests made along the path.

share|improve this answer
Using +norecurse just tells the nameserver to return whatever information it has (including cached info, if any), so that isn't correct. +trace will work because it will follow the recursion chain all the way to an authoritative server. – Raman Dec 5 '14 at 21:54

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.