Clear Windows DNS Cache

   Posted November 27, 2003 by David Kirk in Windows

Command to reset, flush or clear your DNS cache.

Vista, Windows 7, and WIndows 8

These same directions work in versions of Windows after XP; however, you’ll need to gain admin privileges first:
Vista, Windows 7, and Windows 8 directions for flushing the dns cache.

XP

XP remembers negative (DNS unable to resolve) entries for a few minutes. Often this can be a pain when moving and debugging sites. As long as that negative entry sits in your DNS cache, your box will continue to give you a cannot find server error. By cleaning out your DNS cache, you can fix this problem.

Rebooting will flush your cache… but there is an easier way.

Drop to a command box and type:

ipconfig /flushdns

If you wish to stop XP from placing negative entries into cache, you can make this change in your registry.

1. Goto HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ Dnscache\Parameters
2. Build a new DWORD value called NegativeCacheTime and give it a value of 0

I believe the default time is 5 minutes. I always use zero for my default time, but I think the value above is in seconds. So if you only want to save them for 1 minute, then I am assuming you would change that value to 60.

 

About David Kirk

David Kirk is one of the original founders of tech-recipes and is currently serving as editor-in-chief. Not only has he been crafting tutorials for over ten years, but in his other life he also enjoys taking care of critically ill patients as an ICU physician.
View more articles by David Kirk

The Conversation

Follow the reactions below and share your own thoughts.