Disabling Caching of Failed DNS Lookups

  • Section(s): DHCP and DNS, Miscellaneous, Network
  • Published on Apr 11, 2006.
  • Last Modified on Apr 11, 2006.
  • Last Modified by Mitch Tulloch.
  • Rated 3.7 out of 5 based on 9 votes.
How to prevent caching of failed DNS lookups from preventing you from having DNS name queries resolved.

When Microsoft Windows platforms try and resolve a DNS name against a name server, the result is cached regardless of whether the query is successful or fails. For example, if you mistype an URL into the address bar of Internet Explorer and press Enter, your ISP's name server will return a result indicating that the query failed. If you try again and mistype the URL again, you'll naturally get the same result but faster since the URL is now being resolved from your computer's DNS cache.

But what if you typed the URL correctly but the name server cannot resolve it due to a transient server problem? In that case, the negative response is cached and any attempts you make to open the URL fail until the failed name lookup expires from your DNS cache. So even if the name server becomes available and can resolve name queries, your computer won't actually send the query for the URL until the cache entry for it expires.

There are several workarounds you can try to resolve this:

1. Boot your computer (clears the cache). Obviously not the best solution.

2. Open a command prompt and type ipconfig /flushdns to clear the cache. Works fine but it's clearly a workaround not a solution.

3. Open Registry Editor and go to the following key:

HKLM\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters

Then create the following three DWORD values and set them each to zero:

  • NegativeCacheTime
  • NetFailureCacheTime
  • NegativeSOACacheTime

The only negative effect from this tweak is that if you repeatedly type the wrong URL for a site, you'll get slower failed responses as they all come from the name server and not your cache. But the response delay itself should tell you that you're typing the URL wrong anyway.

As usual use caution when editing the Registry and back it up first before making changes.

About Mitch Tulloch

Mitch Tulloch was lead author for the Windows Vista Resource Kit from Microsoft Press, which is the book for IT pros who want to deploy, maintain and support Windows Vista in mid- and large-sized network environments. Mitch was also the author of Introducing Windows Server 2008 and technical project lead for the Microsoft Office Communications Server 2007 Resource Kit, both books also from Microsoft Press. For more information on these and other books by Mitch, see www.mtit.com .

Share this article


Article not looking right or info is missing? Let us know so that we can fix it: .


Receive all the latest articles by email!

Receive Real-Time & Monthly WindowsNetworking.com article updates in your mailbox. Enter your email below!
Click for Real-Time sample & Monthly sample

Become a WindowsNetworking.com member!

Discuss your network issues with thousands of other network administrators. Click here to join!

Community Area

Log in | Register

Readers' Choice

Which is your preferred Help Desk solution?