Table of Contents

Networking - DNS - Clear DNS Cache

Flush Bind Server DNS Cache

A caching BIND server obtains information from another server (a Zone Master) in response to a host query and then saves (caches) the data locally.

All you have to do is restart bind to clear its cache:

/etc/init.d/named restart

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

rndc restart

or

rndc exec

BIND v9.3.0 and above will support flushing all of the records attached to a particular domain name with rndc flushname command.

In this example flush all records related to sharewiz.net domain:

rndc flushname sharewiz.net

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

Flush dnsmasq DNS Cache

dnsmasq is a lightweight DNS, TFTP and DHCP server.

It is intended to provide coupled DNS and DHCP service to a LAN.

Dnsmasq accepts DNS queries and either answers them from a small, local, cache or forwards them to a real, recursive, DNS server.

This software is also installed many cheap routers to cache DNS queries.

Just restart the dnsmasq service to flush out dns cache:

sudo /etc/init.d/dnsmasq restart

or

service dnsmasq restart

Flush nscd DNS Cache

Nscd caches libc-issued requests to the Name Service. If retrieving NSS data is fairly expensive, nscd is able to speed up consecutive access to the same data dramatically and increase overall system performance. Just restart nscd:

sudo /etc/init.d/nscd restart

or

service nscd restart

or

service nscd reload

Flush Mac OS Sierra DNS Cache

sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponder

Flush Mac OS X DNS Cache

sudo dscacheutil -flushcache

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

lookupd -flushcache 

Flush Ubuntu DNS Cache

sudo systemd-resolve --flush-caches

Flush Windows DNS Cache

ipconfig /flushdns