Ubuntu – How does one clear dig’s DNS cache on Ubuntu

dnsUbuntu

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

Best Answer

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.