Daily Tech Notes » How to clear local DNS cache to reflect hosting server changes

When you transfer your domain from one host to another, you change your nameserver configuration. But the problem is that sometimes it takes a while for the nameserver change to propagate through the DNS server of your ISP. Sometime the DNS configuration is cached on your computer or browser session. Here are some tips to remove DNS cache and also to see hosting server changes immediately.

Clearing DNS Cache on Microsoft Windows

From the command prompt (start=>run=>cmd) enter the command ipconfig/flushdns. This will purge the DNS resolver cache.

This will remove dns cache entries from your machine. But you will still have a problem if your ISP DNS cache is holding the old DNS entry. There is a simple trick to bypass DNS mechanism in Windows.

Search for the file named “hosts” inside Windows folder. In my Windows Vista machine this is located inside c:\windows\system32\drivers. Add a new line like the one below(replace domain with your domain and IP address with the IP address of the Web host machine where your domain is relocated).


“hosts” is first searched by Windows to resolve a domain to an IP address effectively short circuiting the ISP DNS.

Clearing DNS cache on Linux

On linux you can use the command sudo /etc/init.d/nscd restart  to clear DNS cache. This assumes that nscd is already installed in your linux box.  On ubuntu you can try restarting the networking service using the command sudo /etc/init.d/networking restart.

The above mentioned Windows trick can also be applied on linux machines. In linux you need to modify /etc/hosts file and add your domain and domain hosted server ip as given below. You need restart the networking using sudo /etc/init.d/networking restart for this to work.


Clearing DNS cache on Mac

On a Mac OS X you can clear DNS cache by typing the command lookupd -flushcache.

Clearing DNS cache from browsers

DNS is also cached at browsers. Most of the time this is cleared when you close all the browser sessions. In Firefox this can be forced by clearing the private data from tools menu.

Scroll to Top