DNS cache is essential to speed up internet access and improve the browsing experience by storing the recent domain name. All computer operating systems use cache to store DNS lookup results. This helps accelerate network performance; however, in some instances, this could cause an issue.
The DNS cache can get in the way of creating a new site or configuring domain settings for an old one.
How to Clear DNS Cache: A Step-by-Step Guide
The exact steps to clearing the DNS Cache depend on your system. Here are the top four systems that you might be looking for.
OSX Clear DNS Cache
OSX refers to the older macOS version, like the OS X Mavericks, Yosemite, or El Capitan. For each of these versions, the steps would vary slightly. However, the basics remain the same.
1. Open Terminal
Applications > Utilities > Terminal
Alternatively, you can search for a terminal using the spotlight.
Get exclusive access to all things tech-savvy, and be the first to receive
the latest updates directly in your inbox.
2. Enter the specific commands for your OSX version
OS X Yosemite (10.10) and Later
sudo killall -HUP mDNSResponder
OS X Mavericks (10.9) and Mountain Lion (10.8)
sudo killall -HUP mDNSResponder
OS X Lion (10.7) and OS X Snow Leopard (10.6)
sudo dscacheutil -flushcache
3. Admin Password
Enter the admin password and press enter.
4. Verify
Lastly, test if the chase is cleared by pinging a domain.
ping example.com
MacOS Clear DNS Cache
For macOS Big Sur, Monterey, Ventura, and Later, follow these steps:
1. Open Terminal
Applications > Utilities > Terminal
Alternatively, you can search for a terminal using the spotlight.
2. Run the following command to clear DNS Cache
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
3. Admin Password
Enter the admin password and press enter.
4. Verify
Lastly, test if the chase is cleared by pinging a domain.
ping example.com
For macOS Catalina (10.15) and Mojave (10.14)
1. Open Terminal
Applications > Utilities > Terminal
Alternatively, you can search for a terminal using the spotlight.
2. Run the following command to clear DNS Cache
sudo killall -HUP mDNSResponder
3. Admin Password
Enter the admin password and press enter.
4. Verify
Lastly, test if the chase is cleared by pinging a domain.
ping example.com
Windows Clear DNS Cache
To clear the DNS cache on Windows, follow the following steps.
1. Open Command Prompt
- Win + R to open the run dialog box
- Type cmd and enter
Alternatively, you can search for the command prompt, right click and run as administrator.
2. Run the command
ipconfig /flushdns
You should see the following message if the process was successful:
“Successfully flushed the DNS Resolver Cache.”
3. Verify
Verify using the command:
ipconfig /displaydns
4. Close the command prompt
Type exit and enter.
Chrome Clear DNS Cache
Follow these steps to clear the DNS cache for Chrome.
1. Launch Google Chrome
Enter the following URL: chrome://net-internals/#dns
2. Clear the DNS cache
On the DNS page, locate the clear cache host and click on it.
3. Clear sockets cache
Go to the sockets tab with this URL chrome://net-internals/#sockets.
Tap Close idle sockets and Flush socket pools to clear related caches.
4. Restart Chrome
Restart the browser to ensure that the cache has been cleared.
How to Flush DNS Cache Using CyberPanel for Your Server’s Operating System
You can flush the DNS cache with CyberPanel a renowned web hosting control panel – but the process isn’t directly available through the CyberPanel GUI itself. However, you can do it through the command line by accessing the server via SSH.
Here’s how you can flush the DNS cache on your server using the command line.
Example: For a Server Running Linux
- Access the server via SSH: Use an SSH client (like PuTTY in my case I’m using Bitvise SSH Client) to log in to my server.
- Flush the DNS cache: Depending on the DNS caching service your server is using, you will use one of the following commands:
–For systemd-resolved
(on Ubuntu/Debian or other systems using systems):
bashsudo systemd-resolve --flush-caches
– Fordnsmasq
(commonly used with CyberPanel):
bashsudo systemctl restart dnsmasq
– ForBIND
(if you’re using it for DNS):
bashsudo rndc flush
– Check if the cache is cleared:
You can check the DNS cache stats to verify if the cache has been flushed.
Forsystemd-resolved
, for example: bashsudo systemd-resolve --statistics
Please Note:
If you’re using CyberPanel and don’t have a caching DNS server setup (like dnsmasq
or bind
), the DNS queries are likely resolved through the DNS servers specified in your system’s network configuration, so flushing the cache might not affect those.
To perform tasks directly within CyberPanel, you’d typically manage DNS zones and settings but for flushing the DNS cache, using SSH commands as described is necessary.
Feel free to ask if you need assistance with SSH access or setting up DNS services in CyberPanel!
Why Should You Flush Your DNS Cache
Flushing the DNS cache helps improve your system performance. Here are a few other reasons you should clear your DNS cache.
Website Access Issues
The outdated or corrupt cache can store incorrect data, leading to problems while accessing the websites. Furthermore, the old cache can point to the wrong location if the website changes its IP address or server.
Fix privacy issues
Flushing cache removes the previous DNS records, which prevents others from viewing or using your data on the local machine.
Enhance system performance
Removing old cache records can free up memory, improve system efficiency, and reduce the risk of conflict.
Avoid 404 Errors
The old cache can point to incorrect locations and IP addresses or load old versions for some websites; clearing the records will reduce such errors.
Avoid DNS Spoofing
Hackers can insert incorrect or malicious DNS entries in your system, known as cache poisoning; regular flushing can help avoid this issue.
Wrapping up!
Regular clearing up your DNS cache can help keep your system efficient, topnotch, and clear of unwanted issues. Flushing cache will also free your system of malicious data and incorrect entries, keeping your data safe.
Frequently Asked Questions
1. What is a DNS cache?
A DNS cache is a database on your device that records recent DNS lookups.
2. Does clearing the DNS cache affect my internet connection?
No, clearing the DNS cache does not affect your internet; it only applies to your system.
3. How often should I clear my DNS cache?
There is no thumb rule, but you can clear it when:
– Troubleshooting website issues
– You suspect DNS cache corruption
4. Will clearing the DNS cache delete my browsing history?
DNS cache and browser history are two separate things. Clearing DNS will not affect your browser history.
5. Do I need admin rights to clear DNS cache?
Yes, in most cases.