how to clear resolver cache?

Kevin Darcy kcd at chrysler.com
Wed Feb 25 23:48:32 UTC 2009


online-reg wrote:
> Hi All:
>
> Bind 9.5.0-p1 on Fedora...how do I clear the cache?
>
> I updated a FUBAR MX record at godaddy.com's NS, with a TTL of 3600. 
> My local BIND seems to be caching the record after I updated at 
> godaddy. When I query the upstream NS that the local server uses, it 
> returns the updated MX record, but when I query localhost, I still get 
> the old record.
>
> I tried all of these:
>
> rndc flush
That should do it.
> rndc reload
> /etc/rc.d/init.d/nscd restart
>
Does nscd cache MX records? On Solaris, at least, it only caches lookups 
made through the standard resolver-library calls (gethostbyname() etc.), 
which don't include MX records. Also, if you're using dig or nslookup to 
query the MX, those utilities probably aren't going through any 
mechanism that would use nscd's cache anyway.

First thing I'd do is see if the flush is actually working. Do an rndc 
dumpdb right after the flush. Is the MX record still in there? If not, 
then flush isn't flushing properly. You might have to actually restart 
to get rid of it.

Curiosity question; do you use views? If so, are you flushing a 
particular view, or just doing a generic flush? I can't say with 100% 
certainty that BIND's default is to flush *all* views. Something to keep 
in mind.

If the record is gone from the cache (as verified above) before you 
query, but the stale record is showing up, then I'd double-check that 
your nameserver is getting this data from where you think it's getting 
it from. If your system isn't too busy, try to catch the queries on a 
tcpdump. Or, turn on debugging.

- Kevin




More information about the bind-users mailing list