Flush DNS - Detailed Guide
Understanding the DNS Resolver Cache
The DNS resolver cache stores recent DNS lookups performed by your operating system. Every time you visit a website, your computer resolves the domain name to an IP address and stores the result locally. This cache reduces network traffic and speeds up repeated visits to the same domains.
How Windows Manages DNS Cache
Windows stores DNS cache entries based on the TTL (Time to Live) value provided by the authoritative DNS server for each record. The TTL tells your system how long to consider the cached entry valid before discarding it and performing a new lookup.
Registry Settings for DNS Cache
Advanced users can control DNS cache behavior through the Windows Registry. The relevant settings are located at:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters
Key Registry Values
- MaxCacheTTL: The maximum time (in seconds) that a positive DNS response is cached. The default value is
86400seconds, which equals 24 hours. Even if a DNS record has a longer TTL, Windows will not cache it beyond this limit. - MaxNegativeCacheTTL: The time (in seconds) that a negative DNS response (domain not found) is cached. The default value is
900seconds, which equals 15 minutes. This prevents your system from repeatedly querying for domains that do not exist.
Flushing the DNS Cache
The ipconfig /flushdns command clears all entries from the DNS resolver cache. This is useful when you need to force your system to obtain fresh DNS information, such as after a DNS record change or when troubleshooting connectivity problems.
ipconfig /flushdns
Refreshing DNS Registrations
In addition to flushing the cache, you can use the following command to refresh all DHCP leases and re-register DNS names:
ipconfig /registerdns
This command initiates a manual dynamic registration of the DNS names and IP addresses configured on the computer. It is particularly useful in Active Directory environments or when your system's DNS registration has become out of date.
Checking the Hosts File
For persistent DNS issues that are not resolved by flushing the cache, consider checking your hosts file. The hosts file takes precedence over DNS lookups and can override DNS resolution for specific domains. It is located at:
C:\Windows\System32\drivers\etc\hosts
Open this file with a text editor (running as administrator) and check for any entries that may be overriding DNS for the domain you are having trouble with. Remove or comment out any unwanted entries by placing a # symbol at the beginning of the line.