Disabling Caching of Failed DNS Lookups

by Mitch Tulloch [Published on 11 April 2006 / Last Updated on 11 April 2006]

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:


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.

See Also

The Author — Mitch Tulloch

Mitch Tulloch is a well-known expert on Windows Server administration and cloud computing technologies. He has published over a thousand articles on information technology topics and has written, contributed to or been series editor for over 50 books.

Featured Links