Mobile Number Tracker
Trace Mobile Number Earn Money Online
© TechWelkin.com

How to Flush DNS Cache on Windows, Linux, Mac

Command to flush DNS in Windows.
Samyak Lalit | November 10, 2014 (Last update: September 13, 2019)

Samyak Lalit is an Indian author and disability rights activist. He is the principal author and founder of projects like TechWelkin, WeCapable, Viklangta, Kavita Kosh among many others.

DNS caching is an important mechanism for increasing speed of website loading in a browser. For a webmaster, I do not need to speak much about the importance of fast loading websites because it is all very well know. But for a visitor also, it is good if something could be done to load the requested websites at a greater speed. DNS and caching of DNS play a significant role in determining how fast your net connection practically works.

Sometimes we need to flush or clear the DNS cache on local computer or on a proxy server. Let’s understand what DNS cache is and how to flush it.

What is DNS?

DNS stands for Domain Name Server. It is a software that resolves domain names to the actual IP address. Sounds too geeky? Well, let’s take an example.

On Internet, all the websites sit on computers that are called servers. Each of these servers are identified with a unique address called IP address. These IP addresses have to be unique in order to avoid any clashes while identifying machines.

When you type a URL, let’s say, techwelkin.com in your browser’s address bar, you actually tell your browser to go to the server of techwelkin.com and fetch the website.

But there is no server on the Internet whose name is techwelkin.com! Servers are identified by IP addresses and not by domain names. So how does your browser brings you the website?

Instead of looking for the server, your browser tells DNS that the user wants to visit techwelkin.com … DNS is a server that keeps a table of domain names and their associated IP addresses. So, DNS looks into its table and finds the IP address for techwelkin.com. DNS gives this IP address to your browser. Then your browsers gets connected with the server whose IP addresses was returned by the DNS.

This is how your browser reaches a particular website.

What is DNS Caching?

To increase the speed of DNS lookup, a cache memory (very fast memory) is setup. Frequently looked up domain names and associated IP addresses are stored in this cache. Fast memory and relatively smaller set of domain names make the search in DNS cache much faster than look up in the entire DNS table.

Where is DNS cache set up?

A DNS cache may be created at many places. Operating system of your local computer may also setup its own DNS cache. If you’re accessing Internet through a proxy server, then the proxy computer may have its own DNS cache. Then eventually your Internet service provider may also have its separate DNS cache.

Why we may need to flush DNS cache?

DNS cache is good because it speeds up the process of finding (and therefore loading) websites. But what if a website is moved from one server to another? In such a case, the associated IP address with that website will change. However, if DNS cache is not refreshed, it will still match the website with the old server.

This is one of the scenarios where we need to flush and refresh DNS cache.

How to Flush and Clear DNS Cache on Windows?

On Windows operating system, you can easily flush DNS cache of the local computer. For this take the following steps:

  1. Go to Start > Run and type cmd to open the Command Prompt. In case of Windows 8 you can press Windows key + R to bring up the Run box.
  2. In the black colored Command Prompt window, type ipconfig /flushdns
  3. Press Enter to issue command and the local DNS will get flushed.
Command to flush DNS in Windows.

Command to flush DNS in Windows.

How to Flush DNS on Linux?

  • Open up a command terminal (either as root or run step 2 with sudo)
  • Run the command /etc/init.d/nscd restart
How to Flush DNS on Apple Mac?

Apple Mac machines have different commands depending upon the operating system running on them. Let’s see these commands according to the OS:

Mountain Lion or Lion

Mac OS X 10.7 or 10.8:

  • Open the command terminal from Utilities
  • Run the command sudo killall -HUP mDNSResponder

Mac OS X Snow Leopard (10.6):

  • Open up a command terminal from Utilities
  • Run the command dscacheutil -flushcache

Mac OS X Leopard (10.5.1) or below:

  • Open a command terminal from Utilities
  • Run the command lookupd -flushcache

How to Flush DNS cache on Proxy Server?

If you’re not seeing the expected website even after clearing the local DNS cache with the help of the above given command, you can be almost certain that the cache of proxy server needs to be flushed.

You can not clear DNS of proxy from your local machine (unless proxy server is also running right on your own machine!)… For clearing the proxy cache, you’ll need to contact your server administrator.

Various proxies have different interfaces. In some cases you’ll find a flush button, whereas in other cases disabling and enabling DNS cache will reset the cache.

Wasn’t it easy to flush DNS in order to clear all the entries from domain-ip table? Although DNS caches are frequently refreshed by servers but sometimes you may need to manually flush them.

I hope it was useful. Please feel free to ask should you have any questions. I will be happy to try and help you. Thank you for using TechWelkin!

© TechWelkin.com

One response to “How to Flush DNS Cache on Windows, Linux, Mac”

  1. ANURAG SINHA says:

    thank u very much
    it works

Leave a Reply

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