If you’re having connection issues, you might want to clear your DNS Cache. This may sound like a complicated and technical process, but it’s much easier than you might think.
In fact, flushing the DNS Cache requires no technical knowledge, especially if you have a detailed step-by-step tutorial to follow.
In this article, you’ll learn what a DNS Cache is, why you may need to flush your DNS Cache, and the many different ways to go about it using flush DNS command.
What Is DNS Cache?
Similar to web browsers, operating systems also store cache files of previous Domain Name System (DNS) lookups in what is called the DNS cache. It consists of compressed information units called resources records (RR) about all visited websites, displayed in ASCII code.
The following are a DNS cache’s components:
- Resource data ‒ contains a record’s description, such as the address and hostname.
- Record type ‒ describes the record’s type (A or AAAA record).
- Record name ‒ showcases the DNS entry’s domain name.
- Time To Live (TTL) ‒ the resource record’s validity time measured in seconds.
- Class ‒ the resource record’s appropriate protocol group.
- Resource data length ‒ refers to the resource data’s value.
When visiting a website for the first time, the user’s’ operating system stores that site’s DNS cache files. It streamlines the DNS lookup process by resolving domains to their IP addresses, making web pages load faster the next time you visit the same IP address.
Reasons to Flush DNS Cache Periodically
Most operating systems perform DNS caching to lessen the DNS servers’ burden during high traffic. Its TTL determines the cache’s validity period. As long as the cache files are still valid, they will answer content requests without going through the DNS server.
Despite this, using corrupt or outdated DNS cache files can lead to errors and security vulnerabilities. Your operating system may store a bad DNS cache when you visit websites that just moved to a new domain name or host. Therefore, we recommend flushing your DNS cache periodically.
Here are the reasons why you should clear your DNS cache regularly:
- To prevent search behavior tracking ‒ storing DNS records makes it easier for hackers to predict your browser history.
- Security ‒ DNS cache files are the main target for DNS spoofing, which endangers users’ sensitive information like login credentials and personal data.
- To solve technical problems ‒ forcing the operating system to search updated DNS records can solve connection issues and incorrectly displayed web content.
Ways to Flush DNS Cache
Depending on your operating system, the steps to flushing a DNS cache may vary. The tutorial below will show you how to do it on Windows, Linux, and Mac OS X.
Microsoft Windows
On Microsoft Windows flush DNS cache is a relatively simple process. Keep in mind that you need to run as administrator when executing the command prompt to access all system security permissions.
Here are the steps to flushing DNS cache on Windows XP, 7, Vista, 8, 8.1, and 10.
- Press Windows+R keys together or right-click Windows’ Start menu and then click Run. Type cmd to open the Windows command prompt console. If you don’t have administrator privileges yet, run the cmd command by pressing Ctrl+Shift+Enter.
- Type ipconfig /flushdns on the command prompt and press enter. This command will clear DNS cache files on your computer and reset the DNS resolver cache.
- If the process is successful, you’ll see the confirmation message on your command prompt as follows:
Linux
By default, Ubuntu doesn’t cache DNS records. If you manually install a DNS service like name service caching daemon (nscd), the steps below will show you how to flush DNS cache on your computer. Make sure to run as administrator when following these steps.
- Press Ctrl+Alt+T keys together to open the terminal window.
- Enter the following command line to clear DNS cache files on the init.d subdirectory:
sudo /etc/init.d/nscd restart
Here is the guide to flush the DNS cache on a system that uses systemd.
- Press Ctrl+Alt+T keys together to open the terminal window.
- Type the following command line:
systemd-resolve --flush-caches
- Enter the following in the command prompt to check whether or not the previous command has successfully flushed the DNS cache.
systemd-resolve --statistics
Mac OS X
While the steps to flushing a DNS cache on Mac OS X are simple, you need to run the right flush DNS command based on your current OS X version.
- Press the F4 key, then enter terminal in the Launchpad’s search field to open the command terminal window.
- If you’re using Mac OS Sierra, X El Capitan, X Mavericks, X Mountain Lion, or X Lion, the next step is to enter the following in the command prompt:
sudo killall -HUP mDNSResponder
- To flush DNS cache on Mac OS X Yosemite, enter the command:
sudo discoveryutil udnsflushcaches
- If you’re running on Mac OS X Snow Leopard, use the command:
sudo dscacheutil -flushcache
- For Mac OS X Leopard and below, enter the following command to flush DNS cache:
sudo lookupd -flushcache
- To flush DNS cache on Mac OS X High Sierra, enter this in the command prompt:
sudo killall -HUP mDNSResponder
- Here is the command to flush DNS cache on Mac OS X Mojave:
sudo killall -HUP mDNSResponder
- If you’re running on Mac OS X Catalina, use this command:
sudo killall -HUP mDNSResponder
- Here is the command to flush DNS cache on Mac OS X Big Sur:
sudo dscacheutil -flushcache;
sudo killall -HUP mDNSResponder
Flush Your DNS Cache in Google Chrome
As Google Chrome stores a separate DNS cache from the operating system on your computer, flushing them will have the same benefits. This is particularly important if you use Google Chrome as your main web browser.
Keep in mind that this cache type is different from the browser cache.
Here are the steps to do it:
- Open Google Chrome and enter the following address into its address bar:
chrome://net-internals/#dns
- On the net internal settings page, select Clear host cache.
Conclusion
When experiencing connection issues or seeing incorrectly displayed web pages, your system might be storing corrupted or outdated DNS cache records. You can quickly solve it by using flush DNS command. If doing so doesn’t resolve the problem, try to clear your web browser cache instead.
We hope you find this article helpful in solving DNS server issues. Good luck.
- 0 Users Found This Useful