How to Remove Local DNS Cache

How to Remove Local DNS Cache

In this article, we have illustrated how to empty or flush your local DNS cache.

The process of troubleshooting website issues is challenging. Depending on your issues, you might not know where to begin. A damaged local DNS cache may be caused if your system is having problems connecting to a specific website or server. For several operating systems.

Windows: Clear Local DNS Cache

In Windows, you can clear your local DNS cache using Windows PowerShell or the Command Prompt. There is only one command to run in order to complete the operation.

Step 1: Press Windows Key + x to launch an elevated command prompt from the Power User menu. the Windows PowerShell button (Admin)

Step 2: Use the following command and press “Enter.”
ipconfig /flushdns

The confirmation output is displayed to you as follows.

Successfully flushed the DNS Resolver Cache.

Clear Local DNS Cache on macOS

Run a command in the terminal to cleanse your DNS cache on macOS. Depending on the version of macOS you are using, there are various commands. Launch Terminal and type the proper command for your OS version to clear the local DNS cache on macOS. Additionally, you must enter your password in order to execute these commands.

Mac OS X 10.11 El Capitan, macOS 10.12 Sierra, macOS 10.13 High Sierra, macOS 10.14 Mojave, and macOS 10.15 Catalina
sudo killall -HUP mDNSResponder

OS X 10.10 Yosemite
sudo discoveryutil udnsflushcaches

OS X 10.7 Lion, 10.8 Mountain Lion, and 10.9 Mavericks
sudo killall -HUP mDNSResponder

OS X 10.6 Snow Leopard
sudo dscacheutil -flushcache

Flush Local DNS Cache on Linux

As Windows and macOS, many modern Linux versions don’t make use of a local DNS resolver cache. Please visit the website for your Linux distribution and seek information regarding included default software if you are unsure whether your Linux installation makes use of local DNS caching.

Using Name Service Caching Daemon (NSCD) on Linux

Previously, Name Service Caching Daemon was one of the most widely used Linux apps for DNS caching (NSCD). You can clear the local DNS cache if you have NSCD installed by using one of the following commands in your preferred terminal or bash shell program.

For the current user, use this command to clear the local DNS cache.

nscd -i hosts

This command clears the local DNS cache for all users.

nscd -I hosts

Use systemd in Ubuntu-based Linux Distributions

Systemd-resolved for DNS caching and the System Security Services Daemon (SSSD) for everything else can be used to achieve the capabilities that NSCD offers. On devices running Ubuntu, issue the following systemd command to clear the DNS cache. Upon executing the program, enter your password to finish the function.

sudo systemd-resolve --flush-caches

Other Ubuntu-based Options on Linux

This command can flush the cache in several distributions developed from Ubuntu and Debian.

sudo service dns-clean restart

Other Linux Options

The following command can be used to clear the local DNS cache on Linux distributions that are not Ubuntu-based.

sudo /etc/init.d/dns-clean start

Final Comments


Avoid becoming frustrated while debugging your device’s access to a certain website. A fast approach to figuring out if the problem is more serious is to know how to cleanse your local DNS cache. Utilize these tools to determine how far you need to go in order to solve the issue.

Was this article helpful to you? If you continue having problems with the above outlined, please contact the eTechSupport Team.

Follow us on FacebookTwitter, and LinkedIn for additional information.


Get your free trial now