How can I disable the caching of failed DNS lookups in Windows 2000/XP/2003?

It seems that Windows by default caches the result of failed (aka. negative) DNS lookups for 6 minutes! Sad If you're using dynamic DNS in your company, this can be pretty upsetting. Imagine: you try to check whether a virtual machine is up and running by pinging it's FQDN (eg. virtual12.example.com). Since you use dynamic DNS registration, the ping request will tell you that the DNS request failed. What you probably don't know is that the "DNS Client" Windows service will cache this reply for you for 6 minutes! You start the virtual machine and expect to be able to ping it in a few seconds. Wrong! You're DNS client won't find the IP for the virtual machine (even though the VM already registered the hostname with the company DNS server) for another 6 minutes.

To get around this, I suggest you create the following registry key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\DNSCache\Parameters\NegativeCacheTime. It must be a DWORD and the value should be zero (to disable caching of negative replies altogether).

This also described in the "Configuring Caching and Negative Caching" Technet article. It applies to Windows XP (and probably later) too ... nost just Windows 2000 and 2003. I don't know about Vista or Windows 7 ... if you tried this on any of these latter versions, please let me know in a comment.

P.S.: of course after adding the key to the registry, you most probably have to restart the "DNS Client" service (or reboot) for it to take effect.