64

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

2 Answers2

66

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
    
  • Followup the above command with this:

    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
    

    or

    sudo rndc restart
    

    or

    sudo rndc exec
    

    BIND (>= v9.3.0) supports flushing records from a particular domain and also the lan and wan views.source Examples:

       sudo rndc flush
    

    sudo rndc flushname askubuntu.com

    sudo rndc flush lan

    sudo rndc flush wan


rusty
  • 16,917
56

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
Maythux
  • 87,123