How to Clear/flush DNS Cache on Linux

Some times you are trouble to reach some of the sites due to DNS issue, it may be your local DNS cache was corrupt. For this kind of situation, you need to restart your operating system DNS caching service.

DNS Cache stands for Domain Name Caching system is a temporary database which was maintaining by a computer’s operating system, that contains IP address of websites which you have recently viewed.

We are advising you to read available DNS Utility in Linux, where you can check all the DNS records & related information for further troubleshooting. The DNS utilities are nslookup, dig & host.

Suggested Read :
(#) Check DNS (Domain Name Server) Records On Linux Using Nslookup Command
(#) Check DNS (Domain Name Server) Records On Linux Using Dig Command
(#) Check DNS (Domain Name Server) Records On Linux Using Host Command

See bellow, list of Major DNS Cache server’s used in Linux distribution

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

nscd DNS Cache : nscd – name service cache daemon, Nscd is a daemon that provides a cache for the most common name service requests. The default configuration file, /etc/nscd.conf

dnsmasq DNS Cache : Dnsmasq is a lightweight, small footprint, easy to configure, DNS forwarder and DHCP server. It is designed to provide DNS and optionally, DHCP, to a small network & suitable for resource constrained routers and firewalls. It can serve the names of local machines which are not in the global DNS. It is designed for personal computer use and small size networks, not for big networks.

BIND Server DNS Cache : BIND stands for “Berkeley Internet Name Domain” – The most widely used Name Server Software, BIND is open source software that implements the Domain Name System (DNS) protocols for the Internet. BIND is by far the most widely used DNS software on the Internet, providing a robust and stable platform.

1) Flush DNS cache on Ubuntu/Debian/LinuxMint

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

$ sudo /etc/init.d/dns-clean start
[sudo] password for magesh: [Enter your root password]
 * Restoring resolver state...          [ OK ] 

2) Flush BIND server dns cache

Use the below command to Flush caching BIND server dns cache

# /etc/init.d/named restart
Stopping named: .                                          [  OK  ]
Starting named:                                            [  OK  ]

# service named restart
Stopping named: .                                          [  OK  ]
Starting named:                                            [  OK  ]

3) Flush nscd DNS cache

Use the below command to Flush caching nscd server dns cache

# /etc/init.d/nscd restart

# service nscd restart

# service nscd reload

# nscd -i hosts

4) Flush dnsmasq dns cache

Use the below command to Flush caching dnsmasq server dns cache

# /etc/init.d/dnsmasq restart

5) Flush dns cache in windows

Use the below command to Flush dns cache in windows

# ipconfig /flushdns

Windows IP Configuration

Successfully flushed the DNS Resolver Cache.

We are preparing all articles in-depth to understand by all level/stage Linux administrators. If the article is useful for you, then please spend less than a minute to share your valuable comments in our commenting section.

Magesh Maruthamuthu

Love to play with all Linux distribution

You may also like...

Shares
Close
Please support the site
By clicking any of these buttons you help our site to get better