There was a problem loading the comments.

How to flush DNS cache in Linux, Windows or Mac ?

Support Portal  »  Knowledgebase  »  Viewing Article

To flush DNS cache in Microsoft Windows:-

- 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
- Once you run the command your linux DNS cache will flush.

If you are running Mac OS X Sierra or later, you need to do the following.

  1. Open up a command terminal.
  2. Run the command "sudo killall -HUP mDNSResponder"

If you are running Mac OS X Leopard, you need to do the following.

  1. Open up a command terminal.
  2. Run the command "dnscacheutil -flushcache"

If you are running Mac OS X 10.5.1 or below, you need to do the following.

  1. Open a command terminal.
  2. Run the command "lookupd -flushcache"

What is DNS caching and why should I flush DNS cache?

All Internet hosts, including your computer when it is connected to the Internet, use a DNS server. Every time you go to a website, you need to look up the site's IP address using the domain name of the website. Your request for this lookup is eventually passed to a DNS server somewhere.

But your request is one of thousands, even millions of requests being made at any one time across the Internet. The DNS lookup process requires that if your local DNS server is not Authoritative for the domain that contains the domain name you are trying to reach, it should ask other servers to get an answer. Your local server could get quite busy performing these lookup requests, and this could slow down its performance if it is Authoritative for a domain name.

To combat this the answers that a DNS server gets from another DNS server can be added to their own internal database and retained for a period of time equal to the time to live (ttl) value set on the record stored on the Authoritative DNS server.

Storing these responses is called caching, and allows a DNS server to respond more quickly to multiple queries for the same domain or host. If you are on a website, and want to retrieve the next page on the site, the local DNS server does not have to look up the host again, provided the time to live (ttl) value has not expired and caused the local DNS server to delete the information. This is why it takes so long to contact a website at first, but subsequent requests for pages on the same site are somewhat faster.

Caching DNS servers are configured for recursive lookup as well. This creates a server that will respond to lookup requests by delivering answers from its cache, or looking them up on other servers. It is the job of a caching DNS server to handle general lookups of Internet domains. A caching DNS server reduces the load placed on an Authoritative DNS server by handling the requests that donnot pertain to the local domain.

Almost all Internet Service Providers (ISPs) operate some kind of caching DNS server.

Unfortunately DNS caching is a double-edged sword. It speeds up resolution by storing recent answers, and short-circuiting the normal resolution process. However there is a down side. Because DNS servers cache answers, and don't delete these answers until the time to live (ttl) expires, it can take hours or days for the entire Internet to recognize changes to DNS information for your domain name. Hence to bypass the time to live (ttl) setting for your internal DNS cache and empty it's cached entries, you can flush DNS cache by running the commands given above.

Share via
Did you find this article useful?  

Related Articles


Add Comment

Replying to  

Self-Hosted Help Desk Software by SupportPal