– sudo aptitude install nscd
– sudo /etc/init.d/nscd restart
How to Flush DNS in Linux
In many builds of Linux the nscd daemon is used to manage the client DNS cache. For builds that use this method, restarting the nscd daemon is the primary means to flush DNS cache. Other builds of Linux may run BIND or dnsmasq as the primary name service.
Steps to Flush NSCD DNS Cache
NSCD is used to speed up consecutive access to the same data and improve overall system performance.
Step 1 – Enter “$sudo /etc/init.d/nscd restart and press the “enter” or “return” key.
Step 2 – Once nscd restarts the DNS will be flushed. Alternatively, you can enter “# service nscd restart.”
Steps to Flush DNSMASQ DNS Cache
DNMASQ is used as a lightweight DHCP, TFTP, and DNS server. It was primarily designed to provide DHCP and DNS services to a LAN, accepts DNS queries, and answers them. It is also installed on a number of routers to cache DNS queries or look-ups.
Step 1 – Enter “$ sudo /etc/init.d/dnsmasq restart”
Step 2 – Once dnsmasq restarts the DNS will be flushed.
Steps to Flush BIND Server DNS Cache
Similar to nscd and dnsmasq, to flush DNS cache in BIND simply requires a restart to clear the cache.
Step 1 – Enter “# /etc/init.d/named restart” followed by pressing the “enter” or “return” key.
Step 2 – Once BIND completes restart the DNS will be flushed.