Configure DNS Client Cache Using Regedit
Windows automatically caches DNS query results to accelerate web browsing and network connectivity. By modifying specific values in the Windows Registry via Regedit, you can customize how the DNS client handles this cached data. This includes altering the Time-to-Live (TTL) settings for both successful (positive) and unsuccessful (negative) DNS responses, enabling you to optimize network performance, force quicker DNS record updates, or troubleshoot name resolution issues.
Step 1: Open the Registry Editor
- Press
Win + Ron your keyboard to open the Run dialog box. - Type
regeditand press Enter (or click OK). - If prompted by User Account Control (UAC), click Yes to grant administrative privileges.
Step 2: Navigate to the DNS Client Parameters Key
In the Registry Editor address bar at the top, paste the following path and press Enter:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters
Alternatively, manually expand the folders in the left sidebar to
reach the Parameters key.
Step 3: Configure Cache Values
You can add or modify two primary DWORD (32-bit) values within this key to control DNS caching behavior:
1. MaxCacheTtl (Maximum Positive Cache Time)
Controls the maximum duration (in seconds) that successful DNS responses remain stored in the local cache.
- To configure:
- Right-click an empty space in the right pane, select New > DWORD (32-bit) Value.
- Name the value
MaxCacheTtl(if it does not already exist). - Double-click
MaxCacheTtl. - Under Base, select Decimal.
- In the Value data field, enter your desired maximum
cache duration in seconds (e.g.,
86400for 1 day, or300for 5 minutes). - Click OK.
2. MaxNegativeCacheTtl (Maximum Negative Cache Time)
Controls the maximum duration (in seconds) that failed DNS responses (e.g., domain not found) are stored in the local cache.
- To configure:
- Right-click an empty space in the right pane, select New > DWORD (32-bit) Value.
- Name the value
MaxNegativeCacheTtl. - Double-click
MaxNegativeCacheTtl. - Under Base, select Decimal.
- In the Value data field, enter the desired negative
cache time in seconds (e.g.,
0to disable caching failed lookups entirely, or5to300seconds). - Click OK.
Step 4: Apply the Changes
Registry changes to the DNS Client service do not take effect immediately. To apply the new configuration:
Open Command Prompt as Administrator (press
Win + S, typecmd, right-click and choose Run as administrator).Flush the existing DNS cache by running:
ipconfig /flushdnsRestart your computer, or restart the DNS Client service by running:
net stop dnscache && net start dnscache(Note: On newer Windows versions, stopping
dnscachevia the command line may be restricted; restarting the computer is the most reliable way to apply changes).