Flush Linux DNS Cache (Complete Guide)

Looking to flush DNS Cache on Linux? It is easy – a few simple steps, and you are done. While we get onto the actual topic, let us share in brief why the data is stored in DNS Cache in the first place.

DNS Cache acts as a temporary database to store the information about your visits to a particular website. Your browser and operating system both keep this record so you can access the website quickly.

But if you had been having a network issue or the DNS resolvers have changed, you will have to flush the existing data on the primary database to access the website properly.

If you haven’t done this before, you would have to follow these steps closely. But once you are done with it, you won’t even have to go through this article again; it is that simple.

So, let’s start:

Flush DNS Cache on Linux:

The Linux distribution and caching service in use determine the process for cleaning DNS.

Here we are sharing the steps for the most common services:

Systemd Resolved:

Although most Linux distributions use Systemd Resolved, you can check it through the following command to be sure:

sudo systemctl is-active systemd-resolved.service

If the output is active, it is your system distribution; otherwise, you’ll get an inactive message.

Once you see the active message, you can paste the following command, and you’ll have your DNS cache cleared on your Linux System.

DNSMasq:

For the Linux systems using DNSMasq caching server, you need to give the following command:

sudo systemctl restart dnsmasq.service

Nscd #

If the above two have not been your caching servers, then you might be using Nscd #.

In that case, you can use the following command:

sudo systemctl restart nscd.service

Depending on your caching servers, you can choose your command, and you’ll have your DNS cache cleared.

Also Read: Sorry you are not allowed to access this page error


LEAVE A COMMENT

Comment