How To Flush Linux / UNIX DNS Cache
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:
$ sudo /etc/init.d/nscd restart
OR
# service nscd restart
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 to flush out dns cache:
$ 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:
# /etc/init.d/named restart
Related: Windows Vista / XP Flush DNS Cache with ipconfig Command
Subscribe to our free e-mail newsletter or RSS feed to get all updates.
You can Email this page to a friend.
Related Other Helpful FAQs:
- Clear Linux / UNIX BASH Shell Command Line Cache / History
- Debian / Ubuntu Linux Install tracepath / traceroute6 / tracepath6 commands
- Debian / Ubuntu Linux search package names with apt-cache command
- Turn on telnet server on Debian Linux
- Is it safe to use hdparm command to get or set hard disk parameters under Linux?
Discussion on This FAQ
Leave a Reply
We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!
Tags: /etc/init.d/dnsmasq, /etc/init.d/named, /etc/init.d/nscd, clear dns cache in linux, clear dns cache on linux, clearn dns cache, dns queries, dnsmasq, flush dns cache in linux, flush dns cache on linux, flush linux dns cache, how to clear cache, linux clear dns cache, linux flush dns cache, named, nscd, redhat flush dns cache



April 18th, 2008 at 8:32 am
it dont work for me i have ubunu 7.10
July 10th, 2008 at 10:54 pm
I my experience
service nscd restartdoes not clear NSCD’s cache.service nscd reloaddoes, however.