How to Flush DNS Cache
If you’re having connection issues, you might want to clear your DNS cache. In this blog, you’ll learn the benefits of it and how to flush DNS cache on popular operating systems.
Reasons to Flush DNS Cache Periodically
Similar to web browsers, operating systems also store cache files called Domain Name System (DNS) cache. The cache files contain information about all visited websites — hostnames, IP addresses, and resources records.
Most operating systems perform DNS caching to lessen DNS servers’ burden during high traffic. The caches’ validity period is determined by Time To Live (TTL). As long as the cache files are still valid, they will answer content requests without having to go through the DNS server.
Despite so, using corrupt or outdated DNS cache files can lead to error and security vulnerabilities. Therefore, we recommend you to flush DNS cache periodically.
Here are the reasons why you should clear DNS cache regularly:
- 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.
- 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 DNS cache may vary. The blog below will show you how to do it in Windows, Linux, and Mac OS X.
Microsoft Windows
The following tutorial is applicable for Windows XP, 7, Vista, 8, 8.1, and 10.
- Press Windows+R keys together to open Windows command prompt console, then enter cmd.
- Type the following command to clear DNS cache files on your computer:
- ipconfig /flushdns
If the process is successful, you’ll see the confirmation message 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.
- Press Ctrl+Alt+T keys together to open the terminal window.
- Enter the following command to clear DNS cache files on init.d subdirectory:
- sudo /etc/init.d/nscd restart
Mac OS X
- Press the F4 key, then enter terminal in the Launchpad’s search field to open the terminal window.
- If you’re using Mac OS Sierra, X El Capitan, X Mavericks, X Mountain Lion, or X Lion, enter the following command:
- sudo killall -HUP mDNSResponder
- To flush DNS cache on Mac OS X Yosemite, enter the statement:
- 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
Conclusion
When experiencing connection issues or seeing incorrectly displayed web pages, your system might be storing corrupt or outdated DNS cache records. You can quickly solve it by flushing the DNS cache