Operating systems like Windows, Linux, BSD runs some mechanisms 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 at 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 the 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 MS-DOS command as Administrator by clicking the right mouse button.

Click Yes to open MSDOS prompt as Administrator privileges

We will use ipfoncifg
command with the /flushdns
option like below. 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 mechanisms for DNS caching. We will look most popular and useful two methods to clear DNS cache. These operations require root privileges.
Method 1 is restarting Network Services of the Linux operating system.
Ubuntu, Debian:
$ sudo systemctl restart networking.service
CentOS, Fedora:
$ sudo systemctl restart network.service

Flush DNS with Name Service Cache Daemon
Linux operating systems use 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 a problem after some time. We can flush and clear this DNS cache named nscd
with the following command. This command will restart nscd
daemon.
$ sudo /etc/init.d/nscd restart