The Microsoft Windows operating system stores all DNS look-ups in a cache to speed up the connection for future visits to previously visited websites or servers. DNS for simplifications sake turns domain names like ghacks.net into IP addresses like 188.8.131.52. To simplify it further: computer users make almost exclusive use of domain names, while computers and devices of IP addresses.
The DNS provider is queried during each connection attempt unless the information are already stored in the cache.
You may want to know why someone would want to flush the DNS cache? Lets say you have decided to switch from your provider's DNS server to Open DNS, Google DNS or another free service that promise faster speeds and little extras like user-configured site filtering. If you switch during a session, you will be using old data from the cache if you access sites that you have already visited.
Not a big problem? You may be right, but think about the following situation. A webmaster migrates the website to a new server. It can take up to 48 hours before all DNS servers redirect users to the website on the new server and not the old server. Some webmasters change their DNS server before migrating if the ISP's DNS server is known to be on the slow site when it comes to updating information (another option for webmasters is to edit the hosts file).
The DNS cache can have privacy implications as well, especially on public computer systems or multi-user systems. It is possible to display the contents of the cache, which in turn reveals all the websites that have been visited by the user in the session. Flushing the cache removes the entries so that the next user won't be able to see a list of visited websites.
On to the commands. Windows users need to open a command prompt to flush the DNS cache. The easiest way to do that is to press Windows-r, type cmd, and hit the enter key.
The command ipconfig /flushdns clears the DNS cache. All records up to this point in time are removed from the cache.
Windows IP Configuration
Successfully flushed the DNS Resolver Cache.
You can test if the DNS cache has been flushed with the command ipconfig /displaydns. Please note that the command may still display entries, but those are new entries that have been added to the cache after it has been flushed. Antivirus software may for instance connect automatically to update servers.
Windows IP Configuration
DNS caching can be turned off for a session or completely. The negative effects are that look-ups may take longer, especially in computer networks with connected network shares and devices. Computer workstations without network connections on the other hand are likely not negatively effected by the operation. It is probably best to experiment with the setting first, by disabling it temporarily for a session.
The command to stop the DNS Cache for the active session is net stop dnscache. Please note that you need administrative privileges to run the command successfully. Windows 7 users can do that by clicking on the start menu orb, selecting All Programs > Accessories, right-clicking on Command Prompt and selecting Run as Administrator. The path should be similar for other versions of Windows.
c:\windows\system32>net stop dnscache
The DNS Client service is stopping
The DNS Client service was stopped successfully.
You can start the DNS client service again with the command net start dnscache.
The previous instructions turned off the DNS cache for a single session. A restart would load it as a service again. It is however possible to turn off the DNS cache completely. This is done with the shortcut Windows-r, typing services.msc and hitting enter.
Locate the service DNS Client in the listing and double-click it. The window that opens offers controls to stop the service for the current session, and to change its startup type from manual to disabled.
Disabled means that it won't be started with Windows, which effectively disables the DNS Cache permanently. Another benefit of this is that other users are not able to display the DNS cache to retrieve a list of visited websites and servers.
Windows users who are thinking about disabling the DNS Cache permanently should test it first by disabling the cache for the session. If they do not notice performance drops or slower than usual connections they could go ahead and disable the cache completely.Advertisement
Ghacks is a technology news blog that was founded in 2005 by Martin Brinkmann. It has since then become one of the most popular tech news sites on the Internet with five authors and regular contributions from freelance writers.