Flushing (clearing) the DNS cache under Ubuntu 12.04/11.10

In this article we will see some methods for flushing DNS cache under a system running Ubuntu 12.04/11.10 or older. But before showing you these commands, let's see some of the advantages of flushing DNS cache:

  • Resolve "connection timed out" errors when accessing certain websites
  • Avoid using online proxies to open certain websites
  • Prevent unauthorized users from seeing websites you visited through your DNS cache
  • Get rid of wrong IP addresses in your cache, etc.

To be able to flush (clear) DNS cache under Ubuntu 12.04/11.10, try one or more of these methods:

Method 1

Install first the nscd daemon with this command from the terminal:

sudo apt-get install nscd

Then clear your DNS data with this command:

sudo /etc/init.d/nscd restart

Method 2

You can also try to flush DNS cache with this command:

sudo /etc/init.d/networking restart

Method 3

Try also this command:

sudo /etc/init.d/dns-clean start
Have more questions? Submit a request