Clearing DNS Cache on Linux and Windows
DNS caching helps reduce lookups but sometimes you need to clear it after DNS changes, certificate updates, or to troubleshoot resolution issues.
Modern Linux with systemd-resolved
Most contemporary Linux distributions use systemd-resolved as the default DNS resolver. Flush the cache with:
sudo systemctl restart systemd-resolved
Or use the resolvectl command:
sudo resolvectl flush-caches
To verify the cache was cleared:
resolvectl statistics
Linux with NetworkManager
If your system uses NetworkManager alongside systemd-resolved:
sudo systemctl restart NetworkManager
This restarts the DNS integration but doesn’t always flush all caches. For thorough clearing, combine it with:
sudo systemctl restart systemd-resolved
Legacy: nscd (Name Service Cache Daemon)
Older distributions or systems still running nscd:
sudo systemctl restart nscd
Or via init scripts on systems without systemd:
sudo service nscd restart
Check if nscd is running:
systemctl status nscd
Checking Current DNS Configuration
View your active DNS resolver:
resolvectl status
On systems using /etc/resolv.conf:
cat /etc/resolv.conf
Note that on modern systems, /etc/resolv.conf is often a symlink to /run/systemd/resolve/resolv.conf and is managed automatically.
Flushing DNS Cache on Windows
Windows 10/11 (and Server 2016+)
Open PowerShell or Command Prompt as Administrator and run:
ipconfig /flushdns
Verify the flush succeeded:
ipconfig /displaydns
To clear DNS cache using PowerShell:
Clear-DnsClientCache
View current cached entries:
Get-DnsClientCache
Clearing Windows DNS via Group Policy
For domain-joined systems, you can also flush DNS on remote machines:
Invoke-Command -ComputerName <hostname> -ScriptBlock { Clear-DnsClientCache }
Older Windows (XP through Windows 7)
While no longer supported, the command remains:
ipconfig /flushdns
Run this from an Administrator command prompt.
Browser-Level DNS Cache
Browsers maintain their own DNS caches separate from the OS. This is useful during development or when troubleshooting specific services.
Chrome/Chromium
Navigate to:
chrome://net-internals/#dns
Click “Clear host cache” to flush Chrome’s DNS cache. You can also view recent DNS queries on this page.
Firefox
Firefox doesn’t expose a direct DNS cache flush in the UI. Instead, restart the browser or access about:networking#dns to view DNS information. For debugging, use:
about:config
Search for network.dnsCacheExpiration and reduce the value (in seconds) to force faster cache expiration.
Edge
Navigate to:
edge://net-internals/#dns
Same functionality as Chrome since Edge uses Chromium.
Troubleshooting DNS Issues
After flushing caches, verify DNS resolution:
# Test DNS resolution
nslookup example.com
dig example.com
getent hosts example.com
On Windows:
nslookup example.com
If issues persist after flushing, check that your DNS servers are correctly configured:
resolvectl query example.com
This shows which resolver handled the request and helps identify configuration problems.
2026 Best Practices and Advanced Techniques
For Clearing DNS Cache on Linux and Windows, understanding both the fundamentals and modern practices ensures you can work efficiently and avoid common pitfalls. This guide extends the core article with practical advice for 2026 workflows.
Troubleshooting and Debugging
When issues arise, a systematic approach saves time. Start by checking logs for error messages or warnings. Test individual components in isolation before integrating them. Use verbose modes and debug flags to gather more information when standard output is not enough to diagnose the problem.
Performance Optimization
- Monitor system resources to identify bottlenecks
- Use caching strategies to reduce redundant computation
- Keep software updated for security patches and performance improvements
- Profile code before applying optimizations
- Use connection pooling and keep-alive for network operations
Security Considerations
Security should be built into workflows from the start. Use strong authentication methods, encrypt sensitive data in transit, and follow the principle of least privilege for access controls. Regular security audits and penetration testing help maintain system integrity.
Related Tools and Commands
These complementary tools expand your capabilities:
- Monitoring: top, htop, iotop, vmstat for system resources
- Networking: ping, traceroute, ss, tcpdump for connectivity
- Files: find, locate, fd for searching; rsync for syncing
- Logs: journalctl, dmesg, tail -f for real-time monitoring
- Testing: curl for HTTP requests, nc for ports, openssl for crypto
Integration with Modern Workflows
Consider automation and containerization for consistency across environments. Infrastructure as code tools enable reproducible deployments. CI/CD pipelines automate testing and deployment, reducing human error and speeding up delivery cycles.
Quick Reference
This extended guide covers the topic beyond the original article scope. For specialized needs, refer to official documentation or community resources. Practice in test environments before production deployment.

The DNS may be probably also cached by your DNS provider. You can use the dig command to query the DNS info from your DNS server:
dig @dns_server_address domain_nameFor example:
[zma@localhost ~]$ dig @ns1.dreamhost.com fclose.com
; <> DiG 9.9.4-P2-RedHat-9.9.4-12.P2.fc20 <> @ns1.dreamhost.com fclose.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 52886
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; WARNING: recursion requested but not available
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 2800
;; QUESTION SECTION:
;fclose.com. IN A
;; ANSWER SECTION:
fclose.com. 14400 IN A 64.90.49.224
;; Query time: 921 msec
;; SERVER: 66.33.206.206#53(66.33.206.206)
;; WHEN: Mon Apr 21 14:01:50 HKT 2014
;; MSG SIZE rcvd: 55
[zma@localhost ~]$ dig @8.8.8.8 fclose.com
; <> DiG 9.9.4-P2-RedHat-9.9.4-12.P2.fc20 <> @8.8.8.8 fclose.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 15587
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;fclose.com. IN A
;; ANSWER SECTION:
fclose.com. 14399 IN A 64.90.49.224
;; Query time: 1865 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Mon Apr 21 14:01:59 HKT 2014
;; MSG SIZE rcvd: 55
You may also need to flush certain programs’ own DNS cache.
For example, for Chrome, “browse”
chrome://net-internals/#dnsAnd click on the “Clear host cache” can clear Chrome’s DNS cache.
On Fedora 22, it seems there is no dns caching in the system level with NetworkManager:
No configuration about `dns=dnsmasq` in /etc/NetworkManager/NetworkManager.conf .
About NetworkManager configuration: https://blogs.gnome.org/dcbw/2015/02/16/networkmanager-for-administrators-part-1/