I have a Flint 2 router running the stock firmware, which is a modified form of OpenWRT. Occasionally, a domain has its IP address updated, and you know it has, but your home Internet still takes you to the old IP address. The router's DNS cache is stale. If you want to refresh or clear the DNS cache to get the latest IP-hostname mapping, this blog post will be useful for you.
Table of Contents
- Which Internet providers will this work for?
- Solution 1: Reboot your router
- Solution 2: Using OpenWRT on the command line
- Solution 3: Using OpenWRT on the web interface
- Why do I need to refresh my router's DNS cache?
- I cleared DNS cache on my router, but it doesn't seem to be updated
- How to refresh DNS cache in Windows
- How to refresh DNS cache in macOS
- How to refresh DNS cache in Linux
- Conclusion
Which Internet providers will this work for?
The steps in this blog post should work for any Internet provider, including the following:
- Verizon Fios
- Comcast Xfinity
- Cox
- AT&T Fiber
- T-Mobile Home Internet
- Hughesnet
- EarthLink
- Starlink
- and other providers in the US and other countries
Solution 1: Reboot your router
The easiest way to refresh, delete or clear DNS cache is to reboot your router. Do a power cycle.
- Turn off the router. You can unplug it completely.
- Wait for at least 3 minutes. 120 seconds should be enough, but an extra 60 seconds won't hurt. This will clear the DNS cache completely.
- Turn the router back on. When the router is back up, it will obtain the updated DNS information.
Solution 2: Using OpenWRT on the command line
If your router has OpenWRT or a variant installed, you do not need to restart the operating system. You can restart the dnsmasq
service to clear the DNS cache and start getting a fresh copy of hostname-IP mappings.
- First, SSH in to your router.
- Restart the
dnsmasq
service.
service dnsmasq restart
reload_config
Solution 3: Using OpenWRT on the web interface
If your router has OpenWRT or a variant installed, you can go to the web interface, usually http://192.168.1.1 or http://192.168.9.1 or http://192.168.0.1 to access the Administrator Panel.
- First, login to the Administrator Panel of OpenWRT on your router.
- Find the Startup tab.
- Look for the
dnsmasq
service and click on the Restart button.
Why do I need to refresh my router's DNS cache?
- Website does not show updated data: You know it has been updated, but the updated webpage doesn't show up in your browser. The updated version of the webpage may show up in other people's browsers on their Internet, but not yours.
- Connectivity issues: If there are general network issues, and you are unable to connect to certain websites that you were otherwise able to connect.
- DNS settings changes: Sometimes, the system administrator may have updated the DNS settings at a company-wide level, but you still get the stale DNS information.
- Corrupted DNS cache: At times, glitches in the operating system, malware or crapware can corrupt DNS cache. In that case, you will need to clear the DNS cache.
- DNS cache is poisoned: Similar to the previous one, but if your DNS cache has been poisoned and you're being redirected to malicious websites.
I cleared DNS cache on my router, but it doesn't seem to be updated
If you have flushed out the DNS cache on your router, but it still shows the old stale DNS, it means that your computer OS is still retaining the old stale DNS cache.
This may happen for all operating systems, including Windows, macOS and Linux.
Read on to see how to flush the DNS cache at the operating system level.
How to refresh DNS cache in Windows
In Windows, start the command line by pressing
Then, run this command and press ENTER.
ipconfig /flushdns
After successfully running it, you should be getting the new DNS information.
How to refresh DNS cache in macOS
In macOS, start the Terminal app.
Go to Finder, press command shift u and select Terminal.app.
Run these commands.
sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponder
You will be prompted to enter your password for sudo root access. After successfully running it, you should be getting the new DNS information.
How to refresh DNS cache in Linux
In Linux, start the terminal of your choice.
You need to have sudo root access for this.
Run this command and press ENTER.
sudo systemd-resolve --flush-caches
This command is an alternative.
sudo resolvectl flush-caches
dnsmasq
If you are using the dnsmasq
service, then run this:
sudo systemctl restart dnsmasq
or this:
sudo /etc/init.d/dnsmasq restart
You can also try this:
sudo killall -HUP dnsmasq
BIND DNS server
If you are using the BIND DNS server, then run this:
sudo rndc flush
or if you want to refresh DNS cache for a specific domain such as aruljohn.com
, run this:
sudo rndc flushname aruljohn.com
NSCD Name Service Cache Daemon
If you are using an older server and are running the nscd
daemon, run this:
sudo systemctl restart nscd.service
or this:
sudo service nscd restart
Using USR2 signals
If you want to clear the DNS cache by sending a USR2 signal to the DNS resolver:
sudo killall -USR2 systemd-resolved
sudo killall -USR1 systemd-resolved
sudo journalctl -r -u systemd-resolved
Conclusion
Did any of these commands work for you? Let me know in the comments. Thanks for reading.
Related Posts
If you have any questions, please contact me at arulbOsutkNiqlzziyties@gNqmaizl.bkcom. You can also post questions in our Facebook group. Thank you.