Howto: Disable caching of failed DNS lookups in Windows

Windows caches DNS lookups for 300 seconds (5 minutes) to help reduce network traffic.  This helps to speed name resolution, but can result in problems accessing web sites if bad data is cached.  Clearing the DNS cache can get rid of bad data.  To clear the DNS cache in Windows, run from a command prompt:

 ipconfig /flushdns

To temporarily disable DNS caching in Windows, run from a command prompt:

net stop dnscache

If you would like to permanently disable caching of failed DNS lookups:

1) Open Registry Editor and navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Dnscache\Parameter

2) Create the following value as a dword: NegativeCacheTime

and give it a value of 0 (thats the number zero, not the letter o)

3) Exit out of Registry Editor

Please note you may need to reboot or clear your dns cache (ipconfig /flushdns) in order for previously cached data to be purged.

JSI FAQ tip 10829 shows you can set this via a script by using the following syntax along with the Windows 2000 support tools utility reg.exe (type as all one line):

REG.EXE ADD HKLM\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters /V NegativeCacheTime /T REG_DWORD /F /D 0

Reg.exe is built into Windows XP+ operating systems.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: