DNS cache explained

DNS cache – What does it mean?

The DNS cache is a kind of temporary cache memory that DNS resolvers and different devices have. Inside that memory are stored earlier applied DNS records of searched domain names. These records hold the IP addresses (IPv4 or IPv6) of the domain names and their subdomains, also data about their email server, information for their services, authentication and verification data, and more. All of the information is going to be stored inside the DNS cache. As we mentioned, it is going to be only for a particular amount of time which is defined by the TTL (Time to Live) value that each DNS record has.

How does it work?

A DNS lookup is triggered every time a user requests a domain name. The first step of this search process is checking into the device’s DNS cache included in its operating system (OS). It is associated with a database where many DNS records are stored and their matching TTL values. 

The one responsible for setting the TTL value is the DNS administrator of the domain. Therefore, the requested DNS records could be found there in a case when the TTL is not expired. The DNS query will find its answer, and the domain is going to load quickly.

In a scenario where the TTL has already expired is going to require further steps for finding the needed information. That includes added time for completing the process. 

A DNS recursive server will receive the request of the user and proceed by checking for the needed DNS records in other servers. First, it is going to query the root server that should point to the TLD server responsible for the domain. Next, the TLD server shows to the recursive DNS server, which is the authoritative DNS server that holds all of the DNS records for that specific domain name. The recursive server obtains the needed data and gets back to the browser of the user. 

Lastly, the domain is loaded, and the user is able to visit and explore the website. The DNS data is going to be saved for a particular amount of time in the DNS cache of the user’s device and the recursive server. That way, it will be easily accessible for the next time when the user wants to visit the same domain name.

DNS cache – How to delete it?

The DNS cache could be deleted in several ways. It depends on the browser you utilize and on your OS. 

Linux (Ubuntu 20.04 LTS)

  1. You should open the Terminal. Next, type the following command – sudo systemd-resolve –flush-caches. 
  2. Next, write your sudo password and press Enter. You are ready!

macOS

  1. You should open the Terminal. Next, type the following command – sudo killall -HUP mDNSResponder
  2. Next, write your password and press Enter. You are ready!

Windows

  1. Start by opening the Command Prompt or Windows PowerShell. Next, type the following command – ipconfig /flushdns.
  2. You should receive a confirmation message. You are ready!

Edge/Google Chrome/Opera

  1. Copy this line – chrome://net-internals/#dns. 
  2. Paste the line inside your address bar. Press Enter.
  3. On the page, you will see find “Host resolver cache” and click on “Clear host cache.”
  4. Ready!​

Safari 

  1. Go to “Preferences” and then go to “Advanced.” There, in the menu bar, search for “Show develop menu.” 
  2. Then, find “Develop” and next “Empty Caches.”
  3. Restart your browser. 
  4. You are ready! 

Leave a Reply

Your email address will not be published. Required fields are marked *