For a Microsoft Windows 2000 version of this article, see 245437 (http://support.microsoft.com/kb/245437/EN-US/).
Warning: Improper use of Registry Editor can cause serious problems that may require you to reinstall your operating system. Microsoft cannot guarantee that problems caused by improper use of the registry can be resolved. Using Registry Editor requires your own risk.
This pageOverview More information Use Registry control cache time subnet Priority Division
SummaryWindows contains the client domain Name System (DNS) cache. The client DNS caching feature may cause a false impression that the DNS "loop" is not from the DNS server to the Windows client. If you use
Pingcommand to search for the same a record domain, the client may use the same IP address. This situation differs from the Microsoft operating system prior to Windows 2000. These operating systems do not contain client-side DNS caching capabilities. This article describes how to disable DNS caching.
Attention: This article discusses the client portion of DNS. Do not use this information to make changes to the DNS server.
More InformationTo stop the DNS cache, run any of the following commands:
• |
net stop DnsCache
Or |
• |
SC Server name Stop DnsCache |
To permanently disable DNS caching in Windows, use the Service Controller tool or service tool to set the DNS Client service startup type to Disabled. Note that the name of the Windows DNS Client service may also appear as "DnsCache."
Attention: If you deactivate the DNS resolver cache, the overall performance of the client is reduced, and the network traffic for DNS queries increases.
The DNS Client service optimizes the performance of DNS name resolution by storing previously resolved names in memory. If the DNS Client service is turned off, the computer can still use the network's DNS server to resolve the DNS name.
When the Windows parser receives a positive or negative response to a query, it adds the positive or negative response to its cache, creating a DNS resource record. The parser always checks the cache before querying any DNS servers. If there is a DNS resource record in the cache, the parser uses the records in the cache without querying the server. This behavior can increase query speed and reduce network traffic for DNS queries.
You can use the Ipconfig tool to view and refresh the DNS resolver cache. To view the DNS resolver cache, type Ipconfig/displaydns at the command prompt. Ipconfig Displays the contents of the DNS resolver cache, including the pre-loaded DNS resource records from the Hosts file and the names of any recent queries that the system resolves. After a certain period of time, the parser discards the records in the cache. The time period is specified in the Life time (TTL) associated with the DNS resource record. You can also refresh the cache manually. After the cache is refreshed, the computer must again query the DNS server for any DNS resource records that the computer has resolved before. To remove entries from the DNS resolver cache, type Ipconfig/flushdns at the command prompt.
using the registry to control cache time
Important Notes: This article contains information about modifying the registry. Be sure to back up the registry before you modify the registry, and be sure to know how to restore the registry if a problem occurs. For information about how to back up, restore, and edit the registry, click the following article number to view the article in the Microsoft Knowledge Base: 256986 (http://support.microsoft.com/kb/256986/EN-US/) The length of time that the Microsoft Windows Registry notes is used to cache a positive or negative response depends on the value of the entry in the following registry key:
hkey_local_machine/system/currentcontrolset/services/dnscache/parameters
The TTL of the positive response is the lesser of the following values:
• |
The number of seconds specified in the query response received by the parser |
• |
MaxCacheTtl The value of the registry setting. |
Attention
• |
The default TTL for a positive response is 86,400 seconds (1 days). |
• |
The TTL of the negative response is the number of seconds specified in the Maxnegativecachettl registry setting. |
• |
The default TTL for a negative response is 900 seconds (15 minutes). |
If you do not want to cache negative responses, set the
MaxnegativecachettlThe registry setting is set to 0.
To set the cache time on the client computer, follow these steps:
1. |
Start Registry Editor (Regedit.exe). |
2. |
Locate and click the following key in the registry: hkey_local_machine/system/currentcontrolset/services/dnscache/parameters |
3. |
On the Edit menu, point to New, click DWORD Value, and then add the following registry value: Value Name: maxcachettl Data type: REG_DWORD Default value: 86,400 seconds Numeric data: If you reduce the maximum TTL value in the client's DNS cache to 1 seconds, the client DNS cache appears to be disabled.
Value name: maxnegativecachettl Data type: REG_DWORD Default value: 900 seconds Numeric data: If you do not want to cache negative responses, set the value to 0. |
4. |
Type the value you want to use, and then click OK. |
5. |
Quit Registry Editor. |
Sub-network priority DivisionThe Windows XP DNS Resolver also uses subnet priority partitioning. If the parser receives multiple IP address mappings (A resource records) from the DNS server, and some records contain IP addresses from the network to which the computer is connected directly, the parser places the resource records first. This behavior forces the computer to connect to network resources that are closer to them, thereby reducing network traffic between subnets.
Although "subnet prioritization" does reduce network traffic between subnets, in some cases you may prefer to have the looping functionality work as described in RFC 1794. If so, you can add a value of 0 (REG_DWORD data type) to the following registry key.
Prioritizerecorddataregistry entry to disable the subnet priority partition feature:
hkey_local_machine/system/currentcontrolset/services/dnscache/parametersFor additional information, click the following article number to view the article in the Microsoft Knowledge Base: 297510 (http://support.microsoft.com/kb/297510/EN-US/) How to Modify Live on Domain Name System Records 286834 (http://support.microsoft.com/kb/286834/EN-US/) The DNS Client Service does not Revert to Using the "the" the "the" Windows DNS White paper for more information. To view this white paper, visit any of the following Microsoft Web sites:
• |
Http://www.microsoft.com/windows2000/docs/w2kdns.doc (Http://www.microsoft.com/windows2000/docs/w2kdns.doc) |
• |
Http://www.microsoft.com/technet/prodtechnol/windows2000serv/plan/w2kdns2.mspx (http://www.microsoft.com/ technet/prodtechnol/windows2000serv/plan/w2kdns2.mspx) |
For more information, see "DNS Caching, network prioritization, and security" in the Microsoft Windows XP Professional Resource Kit documentation (DNS cache, network Division of priority and Security) chapter.