Linux - How to flush linux DNS cache nscd, Using nscd command to flush dns cache
How to flush linux DNS cache nscd
The nscd caches are saved to disk on RedHat system, they are located in /var/db/nscd# ls /var/db/nscd/ group hosts netgroup passwd services
When you stop or restart nscd these files just stay there and restarting really wont clear or flush your nscd caches. To clear DNS cache use the --invalidate or -i option. This is roughly
the linux equivalent to ipconfig /flushdns on windows or dscacheutil -flushcache on os x.
# nscd --invalidate=hosts OR # nscd -i hosts
From NSCD man:
Nscd is a daemon that provides a cache for the most common name service requests. The default configuration file, /etc/nscd.conf, determines the behavior of the cache daemon
The daemon will try to watch for changes in configuration files appropriate for each database (e.g., /etc/passwd for the passwd database or /etc/hosts and /etc/resolv.conf for the hosts
database), and flush the cache when these are changed. However, this will happen only after a short delay (unless the inotify(7) mechanism is available and glibc 2.9 or later is vailable),
and this auto-detection does not cover configuration files required by nonstandard NSS modules, if any are specified in /etc/nsswitch.conf. In that case, you need to run the following
command after changing the configuration file of the database so that nscd invalidates its cache:
# nscd -i <database>
The topic on Linux - How to flush linux DNS cache nscd is posted by - Maha
Hope you have enjoyed, Linux - How to flush linux DNS cache nscdThanks for your time