How to Clear/flush DNS Cache on Linux

Sometimes you are facing trouble while accessing some websites hosted on your server,It might be your local DNS cache got corrupt. In that kind of situation you need to restart your DNS cache service. Under Windows you can use the ipconfig command to flush dns cache. However, Linux provides various ways to flush DNS cache.

How to Flush DNS cache on Linux DistRibutions.

Major DNS Cache server’s on linux distribution are below.

  • nscd DNS cache
  • dnsmasq dns cache
  • BIND server dns cache

1- Flush DNS cache on UBUNTU / Debian / Linux Mint

Use the below command to Flush DNS cache in Ubuntu/Debian/Mint Systems.

/etc/init.d/dns-clean start

2- Flush BIND server dns cache

Use the below command to Flush caching BIND server dns cache

/etc/init.d/named restart
OR
service named restart

3- Flush nscd DNS cache

For this Just restart nscd:

/etc/init.d/nscd restart
OR
service nscd restart
OR
service nscd reload
OR
nscd -i hosts

4- Flush dnsmasq dns cache

Just restart the dnsmasq service to flush out dns cache:

/etc/init.d/dnsmasq restart
OR
service dnsmasq restart

That’all to do, Please Give your opinion below if you experience any issues or to discuss your ideas and experiences.