Is There a Need to Clean the DNS Cache?

by Shea Laverty
Command Prompt must be run as administrator to successfully clear cache.

Command Prompt must be run as administrator to successfully clear cache.

The DNS cache is a record of domain names converted into IP addresses during Web browsing and similar activities. The cache makes accessing these IP addresses faster by remembering the IP instead of having to look it up based on the entered domain. Despite the number of addresses the cache can amass over time, flushing the cache isn't always necessary. There are, however, circumstances where it may be a wise decision.

Domain Name System

DNS stands for Domain Name System, a system that automatically converts domain names into IP addresses during Web browsing. The purpose is to make surfing easy, as it's much easier to remember a simple domain name like "google.com" compared to an IP address like "12.345.6.789." As long as a DNS server is connected and available, both will lead to the same website.

Server Migration

Clearing the cache can be useful for webmasters during server migration. While changes to the DNS server are immediate, changes to the cache can take upwards of 48 hours, leaving users attempting to visit a site that no longer exists at its old IP address. When you clear the DNS server cache, the DNS server is forced to look up the new IP for the domain name instead of relying on the cached address. This means instant access to the correct IP address, instead of hours or days to get to the correct address. Clearing the cache can be especially important for websites that rely heavily on steady repeat traffic.

Privacy

Another reason to clear your DNS cache is privacy. The DNS cache records every website visited, regardless of content. This means websites with confidential or objectionable content can also be traced using the DNS cache. By clearing your cache, you clear any record in the DNS of visiting said websites. This is particularly useful if you are using a public computer, where clearing your DNS cache can help reduce the chance of sensitive information falling into the wrong hands.

Maintenance

Cleaning up your cache is also a reasonable maintenance practice. DNS cache data doesn't take up much space, but the list can get very long if you don't clear the cache for a long time. Sites you no longer visit can be expunged and free up space for new entries. This can also prevent the cache from returning bad results and 404 errors when revisiting old websites, as old IP addresses may not reflect the current website addresses.

Clearing the Cache

Clearing the cache is a very simple procedure. Sign in to an administrator account, press "Windows-X" to open the Power User menu, select "Command Prompt," and then type the command "ipconfig /flushdns" (without the quote marks) to completely clears the DNS cache, expunging all domain name and IP address records.

Disabling the DNS Cache in the Current Session

You can also disable the DNS cache for a single Internet session, so that the cache will not record any DNS information until the computer is restarted. Sign in to an administrator account, launch the Command Prompt from the Power User menu, and then change to the System32 folder using "cd" commands. For example, "cd FolderName" changes to a folder inside the current folder, while "cd .." changes to the previous root folder -- use this command to get back to either "Windows" or "C:", and then use the "cd FolderName" command to change to "Windows" and finally "System32." Enter the following command in this folder: net stop dnscache This stops DNS caching for this session. To restart DNS caching for this session, enter the following command: net start dnscache

Disabling the DNS Cache for an Indefinite Period

You can also completely disable DNS caching, so that domain names and IP addresses are not cached at all until you enable DNS caching again. Sign in to an administrator account, press "Windows-R" to open the Run dialog, type "services.msc" (without quotes), and then press "Enter." Double-click "DNS Client" in the Services list, click the "Startup type" menu, select "Disabled," and then click "OK." Before attempting to completely disable the DNS cache, test performance by only disabling a session. If there are no performance drops, you should be fine with completely disabling the DNS cache.