Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

2 Answers 2

up vote 18 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.

dig @ns1.example.com example.com

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

dig example.com 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
2  
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
add comment

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 example.com +norecurse

or

dig example.com +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
add comment

Your Answer

 
discard

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.