What is DNS cache?
The DNS cache is a mechanism for storing the DNS data of previously queried domain names. Different devices, such as DNS recursive servers, mobiles, computers, and tablets, have such cache memory. It has a specific purpose: to reduce the time for resolving a domain name. Thanks to it, the DNS recursive server is not necessary to perform a complete DNS lookup every time a particular domain name is requested.
The DNS information that is kept in the cache memory includes the various different DNS records, such as A record of a specific domain name and the corresponding IP address. However, the data is stored temporarily only for a specific amount of time. Therefore, it is estimated through the TTL (Time-To-Live) value of the DNS records. Once the TTL expires, the DNS resolver will have to perform a new DNS lookup.
Let’s take, for instance, a news website that you visit every morning. The first time you want to visit that specific website, a DNS lookup is completed for the needed IP address. The DNS recursive server receives the IP address and saves it in its cache. The next day, when you type the domain name of your news website, it is going to be a lot faster and easier to load. The reason is the DNS cache that keeps the IP address. Also, a new DNS lookup is not required.
It provides responses to DNS queries of the users faster and optimizes the resources efficiently. DNS recursive only makes the absolutely necessary lookups.
You should you care?
DNS cache is very useful, and unfortunately, cybercriminals are well aware of that. They have found and established a way to take profit from its functionality.
The attackers manage to perform DNS poisoning by inserting fraudulent IP addresses or domain names. That way, they direct the user to a malicious website that is very similar to the original one.
Technical issues or administrative errors could corrupt the DNS cache. Yet, often if something like that appears, it is a sure sign for criminal activity in motion. So, to prevent this risk, it is a good idea to flush the DNS cache regularly.
How to delete the DNS cache?
The process of deleting the cache depends on your OS and your browser that could have different separate DNS cache.
- Open the Terminal. Then type the following command – sudo killall -HUP mDNSResponder.
- Next, write your password and press Enter. Ready!
Linux (Ubuntu 20.04 LTS)
- Open the Terminal. Then type the following command – sudo systemd-resolve –flush-caches.
- Next, write your sudo password and press Enter. Ready!
- Start the Command Prompt or Windows PowerShell. Then type the following command – ipconfig /flushdns.
- You have to receive a confirmation message. The DNS is now clear.
- Go to “Preferences” and next “Advanced.” There, in the menu bar, search for “Show develop menu.”
- Next, find “Develop” and then “Empty Caches.”
- Now, just restart your browser. You are ready!
- Copy this text – chrome://net-internals/#dns.
- Paste the text inside your address bar. Then press Enter.
- On the page you see, search for “Host resolver cache” and click on “Clear host cache.”