HOWTO: flush / clean DNS cache in Linux

Sometimes your system caches too much on DNS query / records.

DNS caching helps alot on reducing time and bandwidth when your application needs DNS informations, but just like anything else in the world; it’s not a good thing when it does too over.

Let’s see how to flush DNS cache in your system.

In Ubuntu:

$ sudo /etc/init.d/dns-clean restart

For Others:

Flush nscd DNS cache:

$ sudo /etc/init.d/nscd restart

OR

$ sudo service nscd restart

OR

$ sudo service nscd reload

OR

$ sudo nscd -i hosts

Flush dnsmasq dns cache

$ sudo /etc/init.d/dnsmasq restart

Flush caching BIND server dns cache

$ sudo /etc/init.d/named restart

OR

$ sudo rndc flush

Refs: How To Flush Linux / UNIX DNS Cache


Originally published at blog.geeky.name on September 24, 2009.

GeekyLog

BlueT’s LoGeeks, Logics of Geeky Thoughts.

BlueT / Matthew Lien 練喆明

Written by

Just another Perl / OpenSource / Security Hacker. CTO / Co-founder @Imonology, Leader @Ubuntu_TW, Founder @OSSPlanet. Promote Ubuntu Linux, Networking, Privacy.

GeekyLog

GeekyLog

BlueT’s LoGeeks, Logics of Geeky Thoughts.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade