The DNS or the Domain Name Server can be characterized as the most essential part of your link to the internet. The DNS translates the domain names to and from the IP addresses so that we don't need to remember or keep a list of all the IP addresses of the websites we ever want to access. Our systems also maintain a list of DNS records so that we can access our frequently visited websites faster through a quick resolution of IP addresses. This cache on our system needs to be flushed from time to time. This flushing is required because websites may change their addresses time and again, so it is a good idea to avoid IP conflict by clearing the cache. Flushing the cache is also an excellent way to clear unnecessary data residing on our systems.
So let us see how we can flush the DNS cache on our Debian systems.
We have executed the commands and procedures mentioned in this article on Debian 11 and Debian 12 systems. Since we are using the Linux command line-the Terminal to flush the cache, you can open it by searching for it through the Application Launcher search.
The Application Launcher can be accessed by using the Super/Windows key from your laptop.
Most Linux systems run the systemd-resolve daemon. Your system already uses it for a lot of things. So let us use it for flushing the cache through the following command:
$ sudo systemd-resolve --flush-caches
In case you get the following message after running the command,
Run the following command to enable the service on your Debian:
$ sudo systemctl enable systemd-resolved.service
Then again run the “systemd-resolve --flush-caches” command.
You can then check the statistics to ensure that your cache size is now zero, and thus cleared. Run the following command to view the statistics:
$ sudo systemd-resolve --statistics
Your cache size 0 in the above output shows that the DNS cache has been cleared.
Another way to clear the DNS cache is by restarting the /etc/init.d/networking utility. Run the following command in your Terminal to do so:
$ sudo /etc/init.d/networking restart
Or use the command:
$ sudo service networking restart
You have now learned two effective methods to clear your DNS cache on Debian. In both cases, the process is pretty simple and does not require restarting your Linux system.
Magento is a free and open-source e-commerce platform written in PHP. It is simple, easy…
ISPConfig is an open-source control panel that allows users to manage multiple servers from a…
As a Linux administrator, you may find it necessary to troubleshoot or test your Simple…
Ubuntu 24.04, like many modern Linux distributions, relies on the NetworkManager for managing network connections.…
Restic is a modern, open-source backup program designed for efficiency, security, and simplicity. It enables…
phpMyAdmin is a popular free tool written in PHP intended to administer MySQL and MariaDB…