Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to use dig to verify some DNS information, but I'm only seeing old results. From what I've read, Ubuntu doesn't cache DNS by default at an OS level. If that's true, then the dig command has its own DNS cache. Presumably, installing a universal DNS cache like NSDC would not prevent dig from using its own cache, so my question is how do I clear the cache used by the dig command?

I realize that DNS information may not propagate right away, but if I dig @8.8.8.8 for example, I get updated results. However, using dig normally on the same domain multiple times will reveal that all results besides the first take 0ms, so clearly there is caching going on at some level.

Edit: Here is the summary from dig superuser.com on the first try:

;; Query time: 233 msec
;; SERVER: 208.109.188.1#53(208.109.188.1)
;; WHEN: Tue Apr 24 10:09:19 2012
;; MSG SIZE  rcvd: 113

and the second try:

;; Query time: 0 msec
;; SERVER: 208.109.188.1#53(208.109.188.1)
;; WHEN: Tue Apr 24 10:09:58 2012
;; MSG SIZE  rcvd: 113
share|improve this question
add comment

1 Answer 1

up vote 5 down vote accepted

dig has no cache of its own, unless you run some caching daemon locally such as nsdc or dnsmasq etc. if you do you just need to restart these daemons to clear the local cache. you can use +trace to see exactly where the results are coming from.

share|improve this answer
    
If I use +trace, it skips the cache and gives me up-to-date results, so that doesn't help me figure out where the cache is. It does reinforce my knowledge of a cache though, since I can immediately try the request again without +trace and still get the old results. I've checked my running processes and checked whether every caching daemon I know of is installed and I'm not finding anything. –  Zeus Apr 24 '12 at 17:01
    
if you have a local cache, dig result should show the local loop ip 127.0.0.1 or something similar. what is the output of a plain dig that you are seeing? –  johnshen64 Apr 24 '12 at 17:06
    
Edit: I put the results in original question, since I can't do code blocks in comments. –  Zeus Apr 24 '12 at 17:10
    
caching does not seem to be done on your local system so you don't have local dns cache, but at your dns server. –  johnshen64 Apr 24 '12 at 17:13
1  
It seems that it was indeed the server. I switched my DNS servers in /etc/resolv.conf to some with shorter cache lifetimes and now I get more up-to-date results. Thanks for your help. Upvote and accepted answer for you. –  Zeus Apr 24 '12 at 17:30
show 2 more comments

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.