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.

When I have made changes on the DNS host.

How do I get the clients (servers) to update/flush their DNS cache, so they see the change right away?

share|improve this question

3 Answers 3

up vote 6 down vote accepted

You can restart BIND on Ubuntu using sudo rndc reload, on Centos I believe you have to /etc/init.d/bind restart.

You can also execute /etc/init.d/networking restart to flush the DNS/networking for local desktops running Ubuntu.

share|improve this answer
    
I don't have references handy, but are you sure rndc reload clears the cache? I don't think it does. –  Michael Kjörling Jun 18 '12 at 13:55
    
If you make a change to the bind configurations, then it's better to flush the dns server using rndc, than restarting the service. If you change the hosts file, then flushing this is done via /etc/init.d/networking restart. I often find myself flushing these configurations. –  Ash Jun 18 '12 at 14:46
    
None if these methods work on my debian wheezy box :( Also tried installing nscd and bind9 just for flushing through those, didn't work. –  Cobra_Fast Mar 4 '13 at 16:45
    
/etc/init.d/networking restart crashes my Ubuntu desktop (GNOME Fallback, I think) –  phyzome Jul 5 '13 at 16:05

Depending on you distribution, the clients may not cache by default. For Ubuntu or CentOS, try this command: sudo /etc/init.d/nscd status

...to see if the caching demon is running. If it is, then your client is caching DNS and you can flush it with this: sudo /etc/init.d/nscd restart

if NSCD is not running then there is nothing to flush on the client and you need to: 1. make sure the old entry is not in the /etc/hosts file 2. make sure the DNS change has already propagated to any DNS slaves (check the resolv.conf for where it is resolving to)

share|improve this answer

I have found that a simple restart does not always clear the cache. The other way of doing it, would be to use the nscd command and invalidate the hosts cache.

# nscd -i hosts

Then you don't even need to restart the caching service.

share|improve this answer

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.