[email protected]Office hours: Mon – Fri 9:00AM – 5:00PMLinkedInXFacebook
NexonHost
Netherlands Dedicated ServersAmsterdam · Equinix AM6Germany Dedicated ServersFrankfurt · Equinix FR4Romania Dedicated ServersBucharest · VoxilityAustria Dedicated ServersVienna · Interxion VIEBulgaria Dedicated ServersSofia · TelepointFrance Dedicated ServersParis · Interxion PAR — Marseille · Digital Realty MRS3Ireland Dedicated ServersDublin · Equinix DB2Italy Dedicated ServersMilan · Irideos AvalonPoland Dedicated ServersWarsawSpain Dedicated ServersMadrid · Equinix MD2United States Dedicated ServersAshburn · Equinix DC
All articles
Getting startedMay 10, 2023

How to Clear (Flush) the DNS Cache on Windows, MacOS, and Linux

How To Clear (Flush) The DNS Cache On Windows, MacOS, And Linux

This article provides instructions on how to flush the DNS cache on different operating systems and web browsers.

DNS cache is a temporary database that stores information about previous DNS lookups. In other words, whenever you visit a website, your OS and web browser will keep a record for the domain and the corresponding IP address. This eliminates the need for repetitive queries to the remote DNS servers and allows your OS or browser to resolve the website’s URL quickly.

However, in some situations like troubleshooting network issues or after changing DNS resolvers, you will need to flush the DNS cache. This will clear the cached DNS entries and perform a subsequent lookup to resolve the domain based on newly configured DNS settings.

 

Clear/Flush DNS Cache on Windows

The process of clearing the DNS cache is the same for all Windows versions. You need to open the command prompt with administrator privileges and run ipconfig /flushdns.

 

Windows 10 and Windows 8

To clear the DNS cache in Windows 10 and 8, perform the following steps:

  1. Type cmd in the Windows search bar.

  2. Right-click on Command Prompt and click Run as administrator. This will open up the Command Prompt window.

  3. On the command line, type the following line and press Enter:

    ipconfig /flushdns

    On success, the system will return the following message:

    Windows IP Configuration
    
    Successfully flushed the DNS Resolver Cache.

 

Windows 7

To clear the DNS cache in Windows 7, perform the following steps:

  1. Click on the Start button.

  2. Type cmd in the Start menu search text box.

  3. Right-click on Command Prompt and click Run as administrator. This will open up the Command Prompt window.

  4. On the command line, type the following line and press Enter:

    ipconfig /flushdns

    On success, the system will return the following message:

    Windows IP Configuration
    
    Successfully flushed the DNS Resolver Cache.

 

Clear/Flush DNS Cache on Linux

On Linux, there is no OS-level DNS caching unless a caching service such as Systemd-Resolved, DNSMasq, or Nscd is installed and running. The process of clearing the DNS cache is different depending on the Linux distribution and the caching service you’re using.

 

Systemd Resolved

Most modern Linux distributions such as Ubuntu 18.04 are using systemd resolved service to cache DNS entries.

To find out whether the service is running use the following command:

sudo systemctl is-active systemd-resolved.service

If the service is running, the command will print active. Otherwise, you will see inactive.

To clear the Systemd Resolved DNS cache, type:

sudo systemd-resolve --flush-caches

On success, the command doesn’t return any message.

 

DNSMasq

Dnsmasq is a lightweight DHCP and DNS caching nameserver.

If your system is using DNSMasq as a caching server, to clear the DNS cache you need to restart the Dnsmasq service:

sudo systemctl restart dnsmasq.service

Or

sudo service dnsmasq restart

Nscd

Nscd is a caching daemon, and it is the preferred DNS caching system for most of RedHat-based distributions.

If your system is using Nscd, to clear the DNS cache, you need to restart the Nscd service:

sudo systemctl restart nscd.service

Or

sudo service nscd restart

Clear/Flush DNS Cache on macOS

The command to flush cache in macOS is slightly different depending on the version you’re running. The command must be executed as a user with system administrator privileges (sudo user).

To clear the DNS cache in macOS, perform the following steps:

  1. Open the Finder.

  2. Go to Applications > Utilities > Terminal. This will open up the Terminal window.

  3. In the command line, type the following line and press Enter:

    sudo killall -HUP mDNSResponder

    Enter your sudo password, and hit Enter again. On success, the system doesn’t return any message.

For earlier versions of macOS, the command to flush cache is different.

macOS version 10.11 and 10.9

sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponder

macOS version 10.10

sudo discoveryutil mdnsflushcache
sudo discoveryutil udnsflushcaches

macOS version 10.6 and 10.5

sudo dscacheutil -flushcache

Clear/Flush Browser DNS Cache

Most modern Web browsers have a built-in DNS client to prevent repetitive queries each time the website is visited.

 

Google Chrome

To clear Google Chrome’s DNS cache, perform the following steps:

  1. Open a new tab and type chrome://net-internals/#dns in Chrome’s address bar.

  2. Click the “Clear host cache” button.

If that doesn’t work for you, try to clear the cache and cookies.

  1. Open the “Clear browsing data” dialog window with CTRL+Shift+Del.

  2. Choose a time range. Select “All time” to delete everything.

  3. Check the “Cookies and other site data” and “Cached images and files” boxes.

  4. Click the “Clear data” button.

This method should work for all Chrome-based browsers, including Chromium , Vivaldi, and Opera .

 

Firefox

To clear Firefox’s DNS cache, perform the following steps:

  1. In the upper right-hand corner, click on the hamburger icon to open Firefox’s menu:

  2. Click on the ⚙ Options (Preferences) link.

  3. Click the Privacy & Security or Privacy tab on the left.

  4. Scroll down to the History section and click on the Clear History… button.

  5. Choose a time range to clear. Select “Everything” to delete everything.

  6. Select all boxes and click “Clear Now”.

If that doesn’t work for you, try the following method and temporally disabled the DNS cache.

  1. Open a new tab and type about:config in Firefox’s address bar.

  2. Search for network.dnsCacheExpiration, temporally set the value to 0 and click OK. Afterward, change back the default value and click OK.

  3. Search for network.dnsCacheEntries, temporally set the value to 0 and click OK. Afterward, change back the default value and click OK.

 

Conclusion

We’ve shown you how to clear or flush DNS cache on Windows, Linux, and macOS operating systems.

Keep reading
How to Implement Network Segmentation and Resource Isolation in Linux.
February 6, 2024

How to Implement Network Segmentation and Resource Isolation in Linux.

How to Implement Network Segmentation and Resource Isolation in Linux. Securing and managing networks in a Linux environment involves advanced practices like network segmentation and resource isolation. This guide explores these concepts, providing detailed instructions and examples for…

Read article
How to open or close ports in Linux.
February 6, 2024

How to open or close ports in Linux.

How to open or close ports in Linux. Effectively managing ports on your Linux system is crucial for both security and service accessibility. This comprehensive guide will provide a detailed walkthrough on opening and closing ports using the robust tools iptables and ufw. Understanding these…

Read article
How to use ypdomainname command.
January 23, 2024

How to use ypdomainname command.

How to use ypdomainname command. In the realm of Linux networking, the ypdomainname command plays a crucial role in the context of the Network Information Service (NIS). NIS, formerly known as Yellow Pages, is a distributed database service that facilitates the sharing of network configuration and…

Read article
Get in Touch

Together, Let’s Build a Faster, Safer Internet.

Build scalable infrastructure with NexonHost — high-performance dedicated servers, VPS hosting, colocation, and DDoS protection across Europe.

Get Started →Contact Us
[email protected]Office hours: Mon – Fri 9:00AM – 5:00PM