How to Clear DNS Cache on Different Operating Systems
Clearing the DNS cache can help resolve issues like slow internet or incorrect domain resolutions. Below are step-by-step instructions for clearing the DNS cache on various operating systems.
Introduction
DNS (Domain Name System) cache stores information about domain names and their corresponding IP addresses. Over time, this cache can become outdated or corrupted, leading to issues like slow internet speeds or incorrect domain resolutions. Clearing the DNS cache can help restore proper network functionality.
macOS
On macOS Monterey (and newer), you can flush the DNS cache using the following command:
- Open Terminal: Open your terminal application.
- Flush DNS Cache: Run the command:
sudo networksetup flushDNS
- This will clear the DNS cache on your system.
Note: After clearing the cache, test your internet connection to ensure it resolves correctly.
Linux
On Linux, there are multiple ways to clear the DNS cache:
Method 1: Using NSCD
- Restart the NSCD service:
sudo /etc/init.d/nscd restart
- This will flush the DNS cache on your system.
Verification: Check if the cache is cleared by running:
sudo nslookup google.com
Look for "Server: 10.100.0.1" to confirm flushing.
Method 2: Using systemd-resolve
- Flush the cache with:
sudo systemd-resolve --flush-caches
- Verify cache status by running:
Look for "Current Cache Size" to confirm flushing.sudo systemd-resolve --statistics
Windows
On Windows, you can clear the DNS cache using the ipconfig
command:
- Open Command Prompt:
- For Windows 10/11: Right-click on the Start button and select "Command Prompt".
- For earlier versions, click "All Programs > Accessories > Command Prompt" and run as Administrator.
- Flush DNS Cache: Enter the following command:
ipconfig /flushdns
- This will clear your system's DNS cache.
Additional Notes
- After clearing the cache, test your internet connection to ensure it resolves correctly.
- If issues persist, contact your network administrator or check if any cached data is needed for specific applications.