Operating systems like Windows, Linux, Bsd runs some mechanism to cache DNS records in the local system. Caching DNS records locally gives less bandwidth and fast internet access to the user. In this post we will look how to flush DNS cache in the operating systems like Windows and Linux (Ubuntu,CentOS,Fedora,Debian etc.)
Flush DNS For Windows
Windows operating system provides flush operation from command line with ipconfig tools. Flushing DNS cache required Administrator privileges in Windows operating system from Windows Vista to Windows 10. Windows XP by default provides Administrator privilege. We will use ipconfig flush DNS mechanism for Windows.
Open MSDOS command as Administrator by clicking right mouse button.
Click Yes to open MSDOS prompt as Administrator privileges
Write command below to flush DNS cache
> ipconfig /flushdns
Successful. We have completed clearing DNS cache
Flush DNS For Linux
Linux operating system provides different tools and mechanism for DNS caching. We will look most popular and useful two method to clear DNS cache. These operations requires root privileges.
Method 1 is restarting Network Services of the Linux operating system.
$ sudo systemctl restart networking.service
$ sudo systemctl restart network.service
Flush DNS with Name Service Cache Daemon
Linux operating systems uses some cache mechanism for DNS and IP matches. This makes the DNS queries run faster without asking a DNS server every time. Most of the requiring DNS queries will be answered from DNS cache. This may create problem after some time. We can flush and clear this DNS cache named
nscd with the following command. This command will restart
$ sudo /etc/init.d/nscd restart