How to 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

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.