Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

how to flush dns of Ubuntu 12.04 LTS (GNU/Linux 3.2.0-23-generic x86_64)

have tried many things form here and here also but nothing is working

share|improve this question
why do you think it is not working? Any stat with dig, Any error message? –  Web-E Feb 3 at 11:55
add comment

2 Answers

up vote 3 down vote accepted

Install nscd using the following command if not yet

sudo apt-get install nscd

Flush DNS Cache in Ubuntu by restarting the nscd

sudo /etc/init.d/nscd restart
share|improve this answer
there is no inbuild tools? –  Vikas Hardia Feb 3 at 11:21
add comment

According to this SU answer "How to clear DNS cache in Ubuntu?", Ubuntu by default does not provide DNS cache service. But if you have one that you installed manually, you could usually restart those services to clean the cache. Here are some examples (source):

  • Run this command to flush DNS:

    sudo /etc/init.d/dns-clean restart
  • You can also use this command:

    sudo /etc/init.d/networking force-reload
  • To flush nscd DNS cache:

    sudo /etc/init.d/nscd restart
  • To flush dnsmasq DNS cache:

    sudo /etc/init.d/dnsmasq restart
  • If you use BIND this should flush DNS:

    sudo /etc/init.d/named restart


    sudo rndc restart
share|improve this answer
This answer is spot on. As a followup, if you have not installed a DNS caching service/local DNS server, then the best course of action is probably to restart your router. Most routers have a DNS cache built-in and turned on by default that DHCP sets up. –  Reid Feb 3 at 17:41
add comment

Your Answer


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.