How to flush dns cache Print

  • 1241


Most of your computer systems will temporarily store the website names that you have been visiting lately. This process speeds up name resolution if multiple lookups are done to the same address, such as is common when browsing the web. Hence, if you visit Securiace.com second time, the system will already have the name mapped and hence will retrieve the mapping (DNS) quickly.


Sometimes a bad DNS entry will be cached and you will need to either flush the DNS cache to get rid of it, or wait up to 24 hours for it to be dropped from the cache automatically. Given below is a comprehensive step-by-step process to flush the DNS.

How to Flush DNS in Microsoft Windows

In Microsoft Windows, you can use the command ipconfig /flushdns to flush the DNS resolver cache. Open the command prompt and type the following:

C:\>ipconfig /flushdns
Windows IP Configuration
Successfully flushed the DNS Resolver Cache.
The above command will completely flush the DNS, deleting any incorrect entries too. 

Turning Off DNS Caching under Microsoft Windows (Advacned users)

If you experience frequent issues with DNS caching under Microsoft Windows, you can disable client-side DNS caching with either of these two commands:

net stop dnscache 
sc servername stop dnscache

This will disable DNS caching until the next reboot. To make the change permanent, use the Service Controller tool or the Services tool to set the DNS Client service startup type to Disabled. You can permanently disable DNS Client by following the below steps:

  • Goto Start and click on Run.
  • Type Services.msc in the Run command box.
  • A window listing all the services will popup. Search for a service called DNS Client.
  • Double click on the listed DNS Client service and click Stop. Similarly, you can restart it by clicking Start.

Flush DNS in Mac OSX

OS X Yosemite

Use the following Terminal command to reset the DNS cache in OS X Yosemite v10.10.4:

sudo killall -HUP mDNSResponder

Use the following Terminal command to reset the DNS cache in OS X Yosemite v10.10 through v10.10.3:

sudo discoveryutil mdnsflushcache

OS X Mavericks, Mountain Lion, and Lion

Use the following Terminal command to reset the DNS cache:

sudo killall -HUP mDNSResponder

Mac OS X v10.6

Use the following Terminal command to reset the DNS cache:

sudo dscacheutil -flushcache

 

Flush DNS in Linux

Note: Different distributions and versions of Linux may have slightly different commands due to differences in configuration. One of the commands below will probably work.

Open up a root terminal window (Ctrl+T in Gnome). Type the following command and hit enter.

/etc/init.d/nscd restart

You may need to use sudo depending on your installation instead:

sudo /etc/init.d/nscd restart

Some distributions support this command:

sudo /etc/init.d/dns-clean start

Or support this command:

sudo service nscd restart

Some installations may have NSDS located in another directory, like the following example. You may need to locate where it is installed to be able to execute the correct command.

/etc/rc.d/init.d/nscd restart

Restart your application (e.g. browser or email).

Hope this article helps to resolve DNS cache problems.


Was this answer helpful?

« Back