How To Flush Linux / UNIX DNS Cache

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

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

 Cannot upload images to phpBB posts

The issue is mainly occurring due to the absence of some code. To fix this issue, do the...

 How to Change Your FTP Port

Lately FTP has been a problem for a lot of hosting providers. Especially since the recent influx...

 Child pid xxx exit signal Segmentation fault (11)

Sometimes apache is crashing and all or some PHP pages are showing blank when you browse it. Also...

 Mailman Error “Bug in Mailman version 2.1.11.cp3?

If you are getting following error when trying to modify mailinglist then execute following...

 How to stop generating core files

You may come across core files which gets generated within your accounts . The possible reason...