Wednesday 7 March 2012

How to clear DNS system cache in Linux / Windows / Mac

DNS (Domain Name System) is a resolution mechanism to translate, resolve and return real IP address of the serving machine against the fully qualified domain name of the URL (Uniform Resource Locator).

Whenever a domain has been resolved, the DNS resolution is stored and cached locally for future use. The caching of DNS on local system ensure the fastest speed to resolve any domain name, and reducing hits, and directly load and burn of DNS name servers. However, it may cause some issues such as some website and web pages not loading or cannot be contacted and connected when browsing, causing by changing of IP address or nameservers that hasn’t been reflected and refreshed on local copy. The symptom is more obvious when user set web browser to use proxy to surf the Internet, and these sites now can be loaded properly.

When encountering any inaccessible or unable to load web page issue, one possible resolution is to try to flush (empty and reset) the DNS cache on the system.

Flush dns to get a new name resolution. Also flush dns cache when you can’t access a newly registered domain name. You can simply flush your dns cache anytime to get new entry.

To flush DNS cache in Microsoft Windows (Win XP, Win ME, Win 2000)

Start -> Run -> type cmd

- in command prompt, type ipconfig /flushdns

- Done! You Window DNS cache has just been flush.

To flush the DNS cache in Linux, restart the nscd daemon

- To restart the nscd daemon, type /etc/rc.d/init.d/nscd restart in your terminal.

  -  /etc/rc.d/init.d/nscd stop
  -  /etc/rc.d/init.d/nscd start

- Once you run the command your linux DNS cache will flush.


To flush the DNS cache in Mac OS X Leopard

- type lookupd -flushcache in your terminal to flush the DNS resolver cache.

- Once you run the command your DNS cache (in Mac OS X) will flush.

To flush the DNS cache in Mac OS X

- type dscacheutil -flushcache in your terminal to flush the DNS resolver cache.

- Once you run the command your DNS cache (in Mac OS X Leopard) will flush.

To flush the DNS cache in Ubuntu

- sudo apt-get install nscd

- sudo service nscd restart

Clear local DNS cache for current user
nscd -i hosts

Clear local DNS cache for all users
nscd -I hosts

Flush caching BIND server dns cache

A caching BIND server obtains information from another server (a Zone Master) in response to a host query and then saves (caches) the data locally. All you have to do is restart bind to clear its cache

# /etc/init.d/named restart

No comments:

Post a Comment