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?


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.

  • 1
    I don't have references handy, but are you sure rndc reload clears the cache? I don't think it does. – user 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
  • 2
    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) – treat your mods well Jul 5 '13 at 16:05

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.


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)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.