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
(OR)
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
(OR)
# service nscd restart
(OR)
# 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
(OR)
# 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
(OR)
# 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 example.com domain, the below command can be used:

rndc flushname example.com

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

Leave a Reply