How to Adjust Windows DNS Cache Settings

When a Windows machine queries a DNS server, the response is either positive (a match was found) or negative (no match was found). The OS stores these results in a local DNS cache so that local clients don't repeatedly query the DNS server for the same address. The cache is made up of recently queried names and entries taken from your HOSTS file.

The cache contains both negative and positive entries. Positive entries are those in which the DNS lookup succeeded, and you were able to connect to the web site. If when Windows looks in the cache, it finds a positive entry, it immediately uses that DNS information and sends you to the requested web site.


You can view the contents of the resolver cache by opening up a command prompt and running the command:

Code:

ipconfig /displaydns


How to Adjust Windows DNS Cache Settings U62J0LK


Negative entries are those in which no match was found, and you end up getting a “Cannot find server or DNS” error in your browser. Similarly, when Windows looks in the cache and finds a negative entry, it gives you the error message without bothering to go out to the site.

Negative entries can lead to problems. When you try to make a connection to a site that has a negative entry in your cache, you’ll get an error message, even if the site’s problems have been resolved, and it’s now reachable.

You can solve this problem, though, using a Registry tweak.  By default, Windows caches negative entries for five minutes. After five minutes, they’re cleared from your cache. However, you can force Windows to not cache these negative entries so that you’ll never run into this problem.

1. Open the Registry Editor by typing Regedit.exe into Start Menu search box or Run dialog box.

2. Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters key.

3. Create a new DWORD value with the name NegativeCacheTime and give it a value of 0.

How to Adjust Windows DNS Cache Settings O7VBkO1

The DWORD determines how much time, in seconds, to keep negative entries in the DNS cache. If you like, you can have the entries stay alive for one second by giving the DWORD a value of 1.

4. Press How to Adjust Windows DNS Cache Settings 7W6b39o keys.

5. Type following command.

Code:

cmd.exe /c ipconfig  /flushdns


How to Adjust Windows DNS Cache Settings 9mQOuHW