How to Flush DNS Cache?

How to Flush DNS Cache From Your Computer?

 How to Flush DNS Cache From Your Computer?

This article is the guide to clear and reset the DNS resolver cache which stores the IP address attached to frequently used DNS names. It is also useful to speed up the DNS propagation for a newly added or modified website, at least it will remove the local cache from your terminal/PC and allow you to receive most recent cache.

Flushing DNS in Microsoft Windows

In Microsoft Windows, you can use the below command to flush the DNS resolver cache

ipconfig /flushdns

1. Click Start > All Programs > Accessories > Command Prompt

2. Input below command and press Enter.

ipconfig /flushdns

3. A successful flushed process will display the following result.

Windows IP Configuration
Successfully flushed the DNS Resolver Cache.

Flushing DNS in Mac OS X Leopard

1. Open up a Terminal window from under Applications/Utilities.
2. Type below command and press Enter.

lookupd -flushcache

Flushing DNS in Mac OS X

1. Open up a Terminal window from under Applications/Utilities.
2. Type below command:

dscacheutil -flushcache
sudo dscacheutil -flushcache

3. If you are using OS X 10.5 or earlier, try the following command:

lookupd -flushcache

Flushing DNS in Linux

Flush nscd DNS cache

nscd caches requests issued to the Name Service by libc library. This service can largely speed up consecutive access to the same data and increase overall system performance.

For clearing nscd cache, just restart nscd service:

# sudo /etc/rc.d/init.d/nscd restart
# service nscd restart
# service nscd reload

nscd provides caching for the most common name service requests. The default configuration file, /etc/nscd.conf, determines the behavior of this service.

Flush dnsmasq DNS cache

dnsmasq is a lightweight DNS server which provides both DNS and DHCP service together to a network. dnsmasq accepts DNS queries and either answers them from a small, local cache or forwards them to a real, recursive DNS server.

Just restart the dnsmasq service using below commands to flush out DNS cache:

# sudo /etc/init.d/dnsmasq restart
# service dnsmasq restart

Flush caching BIND server DNS cache

A caching BIND server obtains information from a zone master server in response to a host query and then saves caches the data locally. All you have to do is restart bind service to clear its cache:

/etc/init.d/named restart

You can also use rndc command as below to flush out all cache:

# rndc restart
# rndc exec

BIND versions from v9.3.0 and above will support flushing all of records attached to a domain name with rndc flushname command. For flushing all records related to domain, the below command can be used:

rndc flushname

It is also possible to flush out BIND views. For example, LAN and WAN views can be flushed using the following command:

rndc flush lan

rndc flush wan

Rohith Krishnan

Rohith SK is an MSC computer science graduate living in Cochin, Kerala. As a technology enthusiast, he is always on the lookout for the latest trends and developments in the field, with a particular interest in cloud computing and DevOps updates. Apart from his passion for technology, Rohith SK is an avid reader and enjoys spending his free time exploring different genres of literature. He believes that reading is one of the best ways to expand one's knowledge and understanding of the world. With his expertise in computer science and a passion for technology, Rohith SK regularly contributes articles and blog posts on the latest trends and updates in the industry. His articles offer insights and valuable perspectives on the various aspects of cloud computing and DevOps, and are widely read and appreciated by readers all over the world. As an experienced technology writer and researcher, Rohith SK's articles are well-researched, informative, and easy to understand, making them accessible to readers of all levels of technical knowledge. Whether you're a beginner looking to learn more about the latest trends in technology, or an experienced professional seeking insights and updates, Rohith's articles are sure to provide valuable information and insights.

Leave a Reply