Sometimes when an authoritative DNS server, or if your private DNS server (which may be providing ad blocking), has a change in records, you may want to pull those records down faster than having to wait the full time-out period. Something that may help, is using a DNS flush command on your local system (or, if you have access, your DNS or private DNS server). Here are some common operating systems which you may want to flush your DNS, and the associated commands.
Windows DNS Flush Command
Since Windows has a large user base, I want to tackle this one first. First, you'll want to open the Command Prompt program. You can do this by pressing the Windows key on your keyboard, then type "cmd", right-click on it, and select the option "Run as administrator". This should open a program that looks like an old Unix terminal where you just type commands. Once there, use this command:
ipconfig /flushdns
MacOS DNS Flush Command
You will first need to open the "Terminal" app, then, depending on the MacOS release you have, you will issue a different command:
- Tiger: lookupd -flushcache
- Yosemite: sudo discoveryutil mdnsflushcache
- Lion/Mountain Lion/Maverick/El Capitan/Sierra/High Sierra/Mojave: sudo killall -HUP mDNSResponder
- Ventura/Monterey: sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
Linux (Ubuntu) DNS Flush Command
If you are using Ubuntu before 22.04:
sudo systemd-resolve --flush-caches
If you are using Ubuntu 22.04 or later:
sudo resolvectl flush-caches
If you are using a different distro, then the command may be very similar to one of these or the same. This is because many distirbutions now are using systemd.
FreeBSD DNS Flush Command
If you are running the local unbound DNS cache, then use:
service local_unbound restart