DNS cache – What is it?

DNS cache – Definition

The DNS cache represents a cache memory for storing DNS data (DNS records) for particular domain names only for a short amount of time. This type of memory mechanism could be found in various devices, machines, smartphones, computers, DNS recursive servers, and more.

There is one main purpose which DNS cache aims at, that is simply not to repeat the long and time-consuming DNS lookup each type a precise domain name is requested.

For instance, you type domain.net in your address bar, and a DNS lookup is triggered by your request to search for its IP address. Then the DNS recursive server finds the needed IP address, and you are able to explore domain.net. All of the DNS records are going to be stored in the DNS cache. So, next time you want to visit domain.net, it is going to load a lot faster because the needed data is going to be in the DNS cache. 

We should mention that the IP address and the DNS data are going to be available in the DNS cache only for a particular amount of time. That amount depends on the TTL (time-to-live) value which is set by the DNS administrator.

Thanks to this caching mechanism, users receive faster answers to their DNS queries which also helps with optimizing the overall resources.

How to clear your DNS cache? 

If you want to clear the DNS cache, you could do it in one of several ways. Here is how to complete this task depending on your browser and your operating system (OS). 

macOS

If you are a macOS user, you should start by opening the Terminal app. Then you just need to type the following command:

sudo killall -HUP mDNSResponder

After that, you should type your password and press Enter. That’s it!

Linux (Ubuntu 20.04 LTS)

In case you are a Linux user, then you also should open the Terminal app. Next, type the following command:  

sudo systemd-resolve –flush-caches

After that, you should type your sudo password and press Enter. That’s it!

Windows

If you are a Windows user, then you should open the Command Prompt or Windows PowerShell. After that, type the following command:

ipconfig /flushdns

Lastly, you should see a confirmation message. That’s it!

Google Chrome/Edge/Opera

Inside your address bar, copy and paste the following line:

chrome://net-internals/#dns

Press Enter, and on the page, you should search for “Host resolver cache” and click on “Clear host cache.”

You are ready!

Safari 

Go to “Preferences” and then click on “Advanced.” Then, search for “Show develop menu” in the menu bar.

After that, search for “Develop” and then click on “Empty Caches.”

The last step is to restart your browser. 

Ready! 

Why should you care?

Based on the fact that DNS cache is really helpful, cybercriminals managed to find a way and take advantage of it. They perform an attack called DNS poisoning (DNS spoofing) and insert fake data (IP addresses and domain names). Such type of fraudulent DNS data (DNS records) directs users to a website that is similar to the original one, yet it is under the control of the criminal. Therefore, it is important to know that flushing the DNS cache regularly could prevent such malicious threats. 

Recommended article: DNS propagation – Get familiar with the process

Leave a Comment

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