How to Flush DNS Cache - Guide for Windows, Linux, and Mac
Posted June 26, 2018, 5:44 p.m. by Asif MumtazDid someone tell you to flush DNS cache and you have no clue where to begin? Or maybe, you are encountering countless 404 errors and you know it has something to do with cache.
Whatever your motivation to delete the DNS cache, this guide provides easy but detailed methods for all operating systems. By the end of this guide, you will know how to flush DNS on Windows, Linux, and Mac.
Not only that, but you will also learn why DNS cache is important and how it speeds up your internet.
Without further ado, letâs get down to why we are here.
What is DNS?
The Domain Name System (DNS) translates domain names to IP addresses, which your browser uses to load resources from a server on the internet. It maintains an index of all public domain names and their IP address.
Put simply, itâs because of the Domain Name System (DNS) that you can access a website by typing its name instead of giving your browser an IP address.
What is DNS Cache and why you need it?
A DNS cache is a temporary database that stores recent DNS lookups on your computer. Your operating system automatically manages this memory to give you a fast browsing experience.
With the memory of recent DNS lookups in the cache, your computer doesn't need to use a DNS server to translate your requested website into an IP address.Â
Instead, it looks up in the DNS cache (it's stored locally on your computer) for a similar request made earlier. If you visited the website earlier, your computer handles name resolution locally, without having to send a request to a public DNS server.
This revolutionary way to handle name resolution locally speeds up the internet for you. Thatâs the reason your computer loads websites quickly that you have visited previously.
So, here is what happens.
- You input a URL name in your browser
- Your computer looks up for domain name resolution locally in the DNS cache database
- Local record found: The web browser access the web server using the IP address from the cache
- Local record not found: Your computer sends the request out to the internet for domain name resolution
- Once the connection to the server (located by the translated IP address) is made, your computer receives web data and displays it in your browser
Now itâs pretty obvious that without DNS cache, you are going through a longer route to reach your web server. It means you will have to wait longer before you see the web page you want to access.
Can I see the DNS cache of my computer?
Since the DNS cache is stored locally on your computer, you can easily view its content by using a simple command.
Here is what you need to do to view DNS cache on a Windows computer.
- Open Run by pressing Windows key and R on your keyboard simultaneously
- When you see a dialogue box, type âCMD'Â and press Enter
- You should be able to see the command prompt loading now
- When the command prompt window is active, type the following press Enter
ipconfig/displaydns
- Now you should be able to see the DNS cache of your computer
Here is how this data may look.
www.bing.com ---------------------------------------- Record Name . . . . . : www.bing.com Record Type . . . . . : 5 Time To Live . . . . : 16 Data Length . . . . . : 8 Section . . . . . . . : Answer CNAME Record . . . . : www-bing-com.a-0001.a-msedge.net Record Name . . . . . : www-bing-com.a-0001.a-msedge.net Record Type . . . . . : 5 Time To Live . . . . : 16 Data Length . . . . . : 8 Section . . . . . . . : Answer CNAME Record . . . . : a-0001.a-msedge.net Record Name . . . . . : a-0001.a-msedge.net Record Type . . . . . : 1 Time To Live . . . . : 16 Data Length . . . . . : 4 Section . . . . . . . : Answer A (Host) Record . . . : 204.79.197.200 Record Name . . . . . : a-0001.a-msedge.net Record Type . . . . . : 1 Time To Live . . . . : 16 Data Length . . . . . : 4 Section . . . . . . . : Answer A (Host) Record . . . : 13.107.21.200
Why flush DNS? What does flushing do?
DNS cache is extremely important to experience the internet at fast speed. Still, you may have to clear this cache when cache poisoning happens.
Here are some classical cases when you need to clear the cache.
- Some technical glitch may corrupt the cache
- A computer virus can easily corrupt DNS cache
- Invalid entry in the cache may corrupt the data
- Malicious websites can load scripts to misdirect DNS request
If any of these cases, your only option is to clear or reset your cache, called DNS flushing.Â
When you flush DNS cache, it effectively resets it and clears all the data, including corrupt entries.Â
How to Flush DNS Cache on your computer
It takes hardly a minute to clear DNS cache on any operating system. Below, you will learn how to reset the DNS cache on Windows, Mac, and Linux.
Flush DNS cache on Windows
To flush DNS on Windows, you donât need to be a geek. Follow the simple steps below.
- Click on Start and type 'CMD'
- Windows will search the program for you
- Click on Command Prompt and wait for the new window to load
- Alternatively, you can open Run and type 'CMD' to open the command prompt window
- Once you have the command prompt window active, simply type the following command and press Enter
ipconfig /flushdns
- Thatâs it!
It will take only a minute to flush DNS on the Windows system.
Flush DNS cache on Linux
If you are running Linux OS, it only takes a single command to flush DNS. Here is the method in easy steps.
- Open terminal on your Linux OS
- Now based on Linux distribution you are running, run the appropriate command from below list
- Ubuntu:
sudo
service network-manager restart - Other Linux flavors:
sudo
/etc/init.d/
nscd
restart
- Ubuntu:
After running the command, it takes just a few seconds to reset the DNS cache on your computer.
Flush DNS on Mac
To flush DNS on Mac, simply follow these steps.
- Open Terminal from Utilities
- Enter the command based on your operating system version and press Enter
- Sierra:
sudo killall âHUP mDNSResponder
- El Capitan:
sudo killall âHUP mDNSResponder
- Yosemite:
sudo discoveryutil udnsflushcaches
- Mavericks:
sudo killall âHUP mDNSResponder
- Mountain Lion:
sudo killall âHUP mDNSResponder
- Lion:
sudo killall âHUP mDNSResponder
- Snow Leopard:
sudo dscacheutil âflushcache
- Older versions:
sudo lookup âflushcache
- Sierra:
- Once you enter the command and hit the Return key, it will take just a few moments to reset DNS on Mac. Â
How to flush DNS cache on your router?
When you are facing issues related to DNS cache, it's important that you also flush the DNS cache on your router. The reason for this is simple.Â
Your router can store DNS cache. To understand how it works, consider the following example.Â
You visited router-reset.com from a laptop at your home. Then a few minutes later, you visited the same website on your mobile phone.Â
When you visited the website the first time, your router looked up for DNS resolution. The second time you sent the request for the same website using a different device. This time the router had already stored the DNS information in the cache and therefore didn't look up and simply return the already-available answer.Â
Sometimes, router cache can become messed up. Make sure you secure your wireless router to avoid having to flush it, interrupting your internet experience.Â
To reset DNS cache on your router, simply unplug it and plug it back. When the router restarts, all cache is gone.Â
Conclusion
A virus or a âbadâ entry can easily corrupt DNS cache on Windows, Mac, and Linux. Luckily, you can delete DNS cache (or flush DNS cache) and get rid of all corrupt entries. Make sure you also restart your router just in case the cache stored on it is corrupted as well. It takes only a minute and doesnât require any technical knowledge.