The primary purpose of DNS cache is to store the location of web servers that we have recently accessed. The next time when we type in that website address, the browser will look for its DNS information in the local cache first and be able to find the site more quickly.
If the location of any web server changes before the entry in the DNS Cache updates, then we can no longer access that site.
Table of Contents
What is the DNS Cache?
DNS cache is a tiny data about frequently used domains and websites. The primary purpose of DNS cache is to speed up browsing, and when remote or ISP DNS servers are down, we can reach that website using Chrome DNS cache.
However, when a website changes its DNS entry or due to some other faulty network condition, we need to flush out the DNS cache to reach to correct IP address on the Internet.
What exactly is DNS cache Flushing?
DNS cache flushing means getting rid of existing cached data DNS entries from Google Chrome. Once flushed, Google Chrome will ask for all the new IP addresses and DNS information for that website.
Should We Flush DNS Cache Manually every time?
Actually no. The DNS cache will clear itself out from time to time without our intervention. That’s because the DNS cache saves a component called TTL, or time to live.
This specifies a period of time (in seconds) in which the DNS record for a site remains valid. Within this time period, any queries to the website are answered from the local cache without querying the DNS server. Once the TTL expires, the entry will be removed from the cache.
When Should We Flush DNS Cache Manually?
There are three main reasons for this.
- Troubleshooting connectivity issues
- Troubleshooting and/or resolving DNS spoofing (e.g. DNS cache poisoning) issues
- Resolving stale content issues (e.g. if a website has moved servers)
check DNS Cache in Windows
We can check the DNS cache based on our system.
Window – The process for viewing our DNS cache entries in Windows is pretty simple. Simply open the command prompt and enter the following command: ipconfig /displaydns.
check DNS Cache in Mac
Mac – open the Console app, select the device from the left sidebar and enter: any:mdnsresponder into the search bar. Next, open the command line and enter the following command: sudo killall -INFO mDNSResponder. We should then be able to go back to the console app and see the list of cached DNS records.
Check DNS Cache in Chrome
chrome – we can also check our DNS cache entries on certain browsers. We can enter: chrome://net-internals/#dns into our address bar which will return our browser’s current list of cached DNS records.
Flush DNS Cache in Windows
We can use the following command to flush DNS cache.
Windows – Open the command prompt or click Run when we open start menu. Then, enter the following command: ipconfig /flushdns. If the command succeeds, we will receive the following message “Successfully flushed the DNS Resolver Cache.”.
Flush DNS Cache in Mac
Mac – Open the command line interface or Terminal and enter the following command: sudo killall -HUP mDNSResponder. We may need to enter the administrator password. If the command succeeds the system will not return any output.
Flush DNS Cache in Chrome
Chrome – navigate to chrome://net-internals/#dns and click the “Clear Host Cache” button.
The next step will be to flush all the Sockets by navigating to chrome://net-internals/#sockets or by clicking on the drop-down menu on the top left of the screen and selecting “Sockets.” Click on the “Flush socket pools“.