What Exactly Is DNS Caching?
DNS Cache is your device or browser's most recent memory of a site that you have visited. The device or application then uses this memory of your site (which includes IP addresses, host names, and other DNS records) to help load your site quickly. While this is awesome from a performance standpoint, sometimes if you have switched to a new server, or made updates that aren't reflecting when you visit your site, you will need to flush your device's DNS if clearing browser cache did not fix the issue.
How Do I Flush DNS From My Operating System?
Linux
*On Linux, there is no OS-level DNS caching unless a caching service such as DNSMasq, Nscd, or Systesmd-REsolved are installed/running. The following example is what would be ran on most modern Linux distros such as Ubuntu 20.04
- Close any open browser windows
- To check if the service is running you can run:
sudo systemctl is-active systemd-resolved.service
- If the above command prints out active, then the following command can be used to clear the Systemd Resolved Cache
sudo systemd-resolve --flush-caches
Windows
- Close any open browser windows
- Type cmd in the Windows Search Bar (Windows 8/10)or start menu search text box (Windows 7)
- Right-click on Command Prompt, and click Run as administrator.
- Once on the command line, type the following:
ipconfig /flushdns
Successfully flushing the DNS Resolver Cache should provide the following message:
macOS
- Close any open browser windows
- Open the Finder
- Go to Applications >> Utilities >> Terminal
- On the command line, type the following:
sudo killall -HUP mDNSResponder
With sudo, you will be prompted for your password. Type in your password, and press Enter. With a successful flush, the command line wil not return any messages
Older macOS Versions commands are as follows:
macOS version 10.6 and 10.5
sudo dscacheutil -flushcache
macOS version 10.10
sudo discoveryutil mdnsflushcache
sudo discoveryutil udnsflushcaches
macOS version 10.11 and 10.9
sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponder
How Do I Flush DNS From A Modem Or Router?
Router/Modem
While typically the above will address the issue, it may be necessary to power cycle your network:
- Turn off your computer.
- Turn off your modem and router (if you have one), then wait for about 30 seconds.
- Plug in your modem, then wait for 1-2 minute for all lights to indicate that it's fully connected.
- Plug in your router (if you have one), then wait for 1-2 minutes for these lights to indicate that services are fully connected
- Turn on your computer.