Why Clear the DNS Cache?
To speed up web browsing and network connections, Windows automatically stores (caches) the IP addresses of the domain names it has recently resolved. However, if a website migrates to a new host, or you change a local server’s IP address, your Windows Server might continue attempting to connect to the old, cached IP address. This results in “Page Not Found” errors or connection timeouts. Clearing (or “flushing”) the DNS resolver cache forces the server to discard the old records and query the DNS server for the fresh, updated IP address.
Step 1: Open the Command Prompt
The DNS cache is easily managed from the command line. You do not strictly need administrative privileges to flush the local client cache, but it is best practice to run it as an admin on a server.
Click the Start button, type cmd, right-click the Command Prompt application, and select Run as administrator.
Step 2: View the Current Cached Records (Optional)
Before you clear the cache, you might want to see exactly which IP addresses your server is currently holding on to. You can display the entire contents of the DNS resolver cache using the following command:
ipconfig /displaydns
This will print a long list of domains, their Time To Live (TTL), and the specific A (IPv4) or AAAA (IPv6) records associated with them.
Step 3: Flush the Resolver Cache
To instantly delete all the cached records and force the server to start fresh, run the flush command:
ipconfig /flushdns
The command prompt should immediately return the message: “Successfully flushed the DNS Resolver Cache.”
Step 4: Verify the Fix
If you were troubleshooting a connection to a specific internal server (e.g., sql-01.corp.local), you should now attempt to ping it:
ping sql-01.corp.local
The ping output will show the fully qualified domain name resolving to the brand new IP address, confirming the old cache data is gone.
Step 5: Clear the DNS Server Cache (DNS Role Only)
Important Note: The steps above only clear the client resolver cache. If your Windows Server is actually hosting the Active Directory DNS Role, and it is handing out old cached IP addresses to other computers on the network, you must clear the Server cache.
To do this, open the DNS Manager console. Right-click your server’s name in the left pane, and select Clear Cache. (Alternatively, you can run the PowerShell command: Clear-DnsServerCache). This will force the server to re-query the global root hints for updated public records.