[How to] Flush Linux / UNIX DNS cache

Started by Xhanch Studio, May 07, 2011, 04:23:02 AM

previous topic - next topic
Go Down

Xhanch Studio

May 07, 2011, 04:23:02 AM Last Edit: May 07, 2011, 09:17:21 AM by Xhanch Studio
Q > I'm on a Dial UP Internet connection under Linux and frequent dial up problem causing dns problems. How do I flush DNS cache under any UNIX / Linux distribution using a shell prompt?

A > Under any Windows version you can use ipconfig command to flush dns cache. However, Linux (UNIX) is more complex and robust as compare to Windows. Linux can run nscd or BIND or dnsmasq as the name service caching daemon under most Linux distributions. Large and workgroup servers may use BIND / dnsmasq as a dedicated caching server.

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:
Code Select
$ sudo /etc/init.d/nscd restart
Code Select
# service nscd restart

Flush dnsmasq dns cache

For your information, 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 to flush out dns cache:
Code Select
$ sudo /etc/init.d/dnsmasq restart

Flush caching 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:
Code Select
# /etc/init.d/named restart
Best Regards,
Susanto B.Sc
Web development services, WordPress plugin and theme development, PSD to XHTML conversion - http://xhanch.com
Read free manga online - http://authrone.com

Go Up