Pages

Sunday, September 4, 2011

How to Clear/Flush DNS cache in Linux/Windows/Mac Os?


How to Clear/Flush DNS cache in Linux/Windows/Mac Os?


                  
                         Each web server has a unique IP address, and whenever you open a website in your browser, all communication between your computer and web server takes place on the basis of IP address.

When you type www.google.com in your browser’s address bar and press enter, the browser must first know the IP address of the web server that hosts www.google.com, so that it can request it for the web page. This process to translate a domain name into Ip address is called DNS Resolution.

The process of DNS Resolution

1. When you type www.google.com in the address bar of your browser, the name www.google.com is first checked in the local DNS cache. If the entry is found there, the request for the web page is sent to the respective IP address.
2. If there is no entry in the local DNS cache, then the HOSTS file is checked. If the HOSTS file contains the entry, then the request is sent to that IP address.
3. If both the local dns cache and Hosts file knows nothing about the domain name, then the name is resolved recursively with the help of DNS servers.
flush dns cache in mac windows and linux How to flush DNS Cache in Windows, Linux, MAC OS

Why you need to flush your DNS Cache?

You must flush (clear) the DNS cache whenever you want to get a domain name to be resolved again.
DNS cache ensures that the domain name is resolved fast, so that you don’t have to wait for it. However, sometimes DNS cache may cause some problems like page not loading and 404 errors. This may happen because the web server that hosts a particular web page changed its IP address, but the DNS cache still tries to get the page from the older IP. Also if you register a new domain, you must flush DNS cache so that it is resolved properly on your computer.


How to Flush cache in Windows?
  1. Open Command Prompt(Start->Run , type cmd and hit enter).
  2. In command promt type
    ipconfig /flushdns
  3. hit enter
Your DNS cache is cleared now, try to load your new website.


How to Flush cache in Linux?


                     Whenever you raise name resolution requests, DNS Clients cache the information of the sites you visit. It implies that DNS Cache a lot of information which includes details of every website you visit, which surely eats up the memory of your system. If you are wondering, how to flush DNScache on Linux, then this tutorial will let you clear all the registered DNS cache.
In order to clean the memory consumed by DNS, you just need to restart the nscd daemon process of your Linux system. Here is the step by step tutorial to flush DNS cache on Linux:
STEP 1: Run the command /etc/rc.d/init.d/nscd restart on your terminal and this will simply restart nscd daemon.

/etc/init.d/nscd restart

STEP 2: Well, there is no step 2 because as soon as you restart your nscd daemon, it will directly flush DNS cache.

How to Clear Cache in Mac Os? 
Open the Terminal
Type the following command:
dscacheutil -flushcache

No comments:

Post a Comment