How To Flush The DNS Cache In Windows

Martin Brinkmann
Mar 13, 2011
Tutorials, Windows, Windows tips
|
10

The Microsoft Windows operating system stores all DNS look-ups in a cache to speed up the connection for future visits to previously visited websites or servers. DNS for simplifications sake turns domain names like ghacks.net into IP addresses like 96.30.22.116. To simplify it further: computer users make almost exclusive use of domain names, while computers and devices of IP addresses.

The DNS provider is queried during each connection attempt unless the information are already stored in the cache.

You may want to know why someone would want to flush the DNS cache? Lets say you have decided to switch from your provider's DNS server to Open DNS, Google DNS or another free service that promise faster speeds and little extras like user-configured site filtering. If you switch during a session, you will be using old data from the cache if you access sites that you have already visited.

Not a big problem? You may be right, but think about the following situation. A webmaster migrates the website to a new server. It can take up to 48 hours before all DNS servers redirect users to the website on the new server and not the old server. Some webmasters change their DNS server before migrating if the ISP's DNS server is known to be on the slow site when it comes to updating information (another option for webmasters is to edit the hosts file).

The DNS cache can have privacy implications as well, especially on public computer systems or multi-user systems. It is possible to display the contents of the cache, which in turn reveals all the websites that have been visited by the user in the session. Flushing the cache removes the entries so that the next user won't be able to see a list of visited websites.

Flushing the DNS Cache

On to the commands. Windows users need to open a command prompt to flush the DNS cache. The easiest way to do that is to press Windows-r, type cmd, and hit the enter key.

The command ipconfig /flushdns clears the DNS cache. All records up to this point in time are removed from the cache.

C:\Users\Martin>ipconfig /flushdns
Windows IP Configuration
Successfully flushed the DNS Resolver Cache.

Displaying the DNS Cache

You can test if the DNS cache has been flushed with the command ipconfig /displaydns. Please note that the command may still display entries, but those are new entries that have been added to the cache after it has been flushed. Antivirus software may for instance connect automatically to update servers.

C:\Users\Martin>ipconfig /displaydns
Windows IP Configuration

Turning Off DNS Caching

DNS caching can be turned off for a session or completely. The negative effects are that look-ups may take longer, especially in computer networks with connected network shares and devices. Computer workstations without network connections on the other hand are likely not negatively effected by the operation. It is probably best to experiment with the setting first, by disabling it temporarily for a session.

The command to stop the DNS Cache for the active session is net stop dnscache. Please note that you need administrative privileges to run the command successfully. Windows 7 users can do that by clicking on the start menu orb, selecting All Programs > Accessories, right-clicking on Command Prompt and selecting Run as Administrator. The path should be similar for other versions of Windows.

c:\windows\system32>net stop dnscache
The DNS Client service is stopping
The DNS Client service was stopped successfully.

You can start the DNS client service again with the command net start dnscache.

The previous instructions turned off the DNS cache for a single session. A restart would load it as a service again. It is however possible to turn off the DNS cache completely. This is done with the shortcut Windows-r, typing services.msc and hitting enter.

Locate the service DNS Client in the listing and double-click it. The window that opens offers controls to stop the service for the current session, and to change its startup type from manual to disabled.

Disabled means that it won't be started with Windows, which effectively disables the DNS Cache permanently. Another benefit of this is that other users are not able to display the DNS cache to retrieve a list of visited websites and servers.

Windows users who are thinking about disabling the DNS Cache permanently should test it first by disabling the cache for the session. If they do not notice performance drops or slower than usual connections they could go ahead and disable the cache completely.

Advertisement

Previous Post: «
Next Post: «

Comments

  1. Som said on June 13, 2012 at 10:00 pm
    Reply

    This problem is a big problem and only they know who have suffered from this . I am a Linux user .But , the way i have solved the issue is applicable for both Linux or Windows users . If a user gets this problem and if he / she uses Internet through high speed LAN connection , this trick will surely work for him/her . Here , we need just to change the DNS entry . Generally , in LAN connection, a user is provided two IP addresses. One is primary address and another is secondary or alternative address . We just need to set5 up the secondary or alternative address as primary address and the primary address as alternative address .Hope this will solve the issue .

  2. Thomas Baumann said on March 21, 2011 at 9:29 pm
    Reply

    Disabling the dns cache will slow down your internet connection, because the domain name must be retrived on almost each request which takes a lot of time. I don’t know any reason why someone would do this. In fact I have raised the time for the dns cache on my machine. Also I have added several domain names to my hosts file to save a lot of dns requests.

    If you only want to flush the dns cache type “ipconfig /flushdns” into a command prompt. There is no need for a software doing that. You can create a shortcut for this, too.

    If you want to speed up your internet connection use something that blocks commercials. You may want to add frequently used host names to your hosts file, too. I have created an application for that if someone is interested (recommended only for users that know what a hosts file is): http://ahe.devs-on.net

  3. Fish said on March 14, 2011 at 1:40 am
    Reply

    Hostsman can quickly flush DNS cache.

  4. yk943249 said on March 13, 2011 at 6:43 pm
    Reply

    Could you pls recommend some free softwares for DNS flushing, Say, Flush 0.9.2?

    1. velociraptor said on April 3, 2011 at 12:52 am
      Reply

      Just use portable freeware : DNS jumper
      http://www.sordum.com/?p=4573

  5. hlm said on March 13, 2011 at 12:56 pm
    Reply

    I’ve disabled the DNS Services since I’m using the the custom hosts file. Is it true that disabling the services will make webpage load faster?

    1. Dan said on March 15, 2011 at 11:08 pm
      Reply

      No, I would imagine it’s just the opposite. Your DNS cache remembers websites that you’ve been to in that session, so when you type google.com the dns cache remembers its DNS and the site loads faster. I suppose it could slow down new sites.

    2. Martin Brinkmann said on March 13, 2011 at 2:12 pm
      Reply

      HLM I doubt it but have not tested the effect yet.

  6. mike1354 said on March 13, 2011 at 12:47 pm
    Reply

    or download ccleaner ..

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

We love comments and welcome thoughtful and civilized discussion. Rudeness and personal attacks will not be tolerated. Please stay on-topic.
Please note that your comment may not appear immediately after you post it.