Wed. Jul 15th, 2020

How to Flush DNS Cache on Linux

1 min read

Everyone knows that the DNS server is one of the core components of the Internet. Without the DNS server, users have to use IP addresses to access websites. This is almost an impossible task, so once the DNS resolution is problematic, the entire Internet will be paralyzed.

When a user performs name resolution in a Windows or Linux client, the IP address corresponding to the domain name is temporarily cached in the operating system to facilitate quick access on the next access and is not required in a short time, then perform a DNS query. However, sometimes the client’s DNS cache record will cause certain problems or problems for the user. For example, if a website has changed its IP address, and Linux still uses the cache record to access it, the access will fail.

So before the DNS cache expires, we have to manually refresh the DNS cache. For Windows users, many users know how to operate. For users who use the Ubuntu client as the main system, you can execute the following command in the terminal to refresh the DNS cache:

sudo /etc/init.d/dns-clean start


sudo systemd-resolve –flush-caches