Flush Linux DNS Cache

Filed Under (Linux) by Brian Keith on 28-10-2010

Tagged Under : , , , , , ,

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
# service nscd restart

Flush dnsmasq dns cache

dnsmasq is a lightweight DNS, TFTP and DHCP server. Dnsmasq accepts DNS queries and either answers them from its cache or forwards them to a DNS server. Restart dnsmasq to flush the cache:
$ sudo /etc/init.d/dnsmasq restart

Flush caching BIND server dns cache

A caching BIND server obtains information from another DNS server (a Zone Master) in response to a host query and then caches the data locally. To clear its cache just restart bind:
# /etc/init.d/named restart