DNS cache is a temporary base data in one operating system which stores all the DNS lookups you perform (information from the websites you have visited and domains).
Its mode of operation is quite simple:
When you visit a site multiple times, your operating system stores the site information in the local cache. So instead of having to send DNS queries to an external DNS server each time, it receives them locally from the DNS cache. That's why loading these sites is so much faster.
However, there are times when the DNS cache can become corrupted. You may also notice that if one changes website, your browser insists on loading the old (the cached) version of the website.
When this happens, what do you do? Flush the DNS cache on your operating system. Once the DNS cache is empty, the initial loading of websites will be slightly slower, but will be correct. Once a page's DNS is re-saved it will re-acquire it speed that you knew
How to clear the DNS cache depends on your operating system. Let's see how you can free up DNS cache on Windows and Linux.
Windows:
Search for cmd. Black will appear icon of the command line. Copy – paste the following command and press enter
ipconfig / flushdns
That's it.
Linux:
You will need a Linux distribution that uses systemd and a user with sudo privileges. This same process will work with both distributions based on Debian-Ubuntu as well as Red Hat based distributions.
Make sure you are running systemd. To do this, open a terminal and give the command:
sudo systemctl is-active systemd-resolved
You should see:
active
Let's clear the memory
sudo systemd-resolve --flush-caches
Warning
If you are using a Red Hat-based distribution other than CentOS, you may find that the systemd-resolve command does not work. In this case, you will need to try one of the following commands to clear the DNS cache:
sudo systemctl restart nscd.service
THE:
sudo systemctl restart named
Debian
In case the order
sudo systemd-resolve --flush-caches
gives you the following message
run the following command:
sudo systemctl enable systemd-resolved.service
Then try running the first command again:
systemd-resolve –flush-caches
To verify that the values are zero run the following command
sudo systemd-resolve --statistics