This problem occurs may be due to DNS caching. Time to live (TTL) is what dictates how long your records stay cached. For example, for how long your A record will be cached before the retrieval of a new copy of the record from DNS servers. The record storage is known as the DNS cache, and the act of storing records is called caching.
What is DNS cache?
DNS cache refers to the temporary storage of information about previous DNS lookups on a machine’s OS or web browser. Keeping a local copy of a DNS lookup allows your OS or browser to quickly retrieve it and thus a website’s URL can be resolved to its corresponding IP much more efficiently.
DNS caching does not only occur at the OS and browser levels. In fact, as mentioned above, a DNS lookup involves various steps. During a new DNS lookup, the lookup passes through the resolver, root server, and TLD server. At each step, information is gathered and cached for later use. Therefore, even if the local DNS cache is empty, the resolver may have a cached copy of the required information thus, avoiding the need to go through the complete DNS lookup process.
How to check your DNS cache?
You can check your operating system’s logs to see which DNS records are cached locally.
- Window – The process for viewing your DNS cache entries in Windows is pretty simple. Simply open your command prompt and enter the following command:
- Mac – The process for viewing your DNS cache entries on a Mac is a little different. You’ll need to first open the Console app, select your device from the left sidebar and enter: any:mdnsresponder into the search bar. Next, open your command line and enter the following command: sudo killall -INFO mDNSResponder. You should then be able to go back to your console app and see the list of cached DNS records.
- You can also check your DNS cache entries on certain browsers. For example, if you’re using Chrome, you can enter chrome://net-internals/#dns into your address bar which will return your browser’s current list of cached DNS records.
How to flush DNS cache?
- Windows – Open your command prompt or click Run when you open your start menu. Then, enter the following command: ipconfig /flushdns. If the command succeeds, you will receive the following message “Successfully flushed the DNS Resolver Cache.”.
- Mac – Open your command-line interface or Terminal and enter the following command: sudo killall -HUP mDNSResponder. You may need to enter your administrator password. If the command succeeds the system will not return any output.
Additionally, to clear the DNS cache in Chrome browsers, navigate to chrome://net-internals/#dns and click the “Clear Host Cache” button.