Posts Tagged ‘nscd’

Flushing the local DNS cache

If your messing around with DNS records and finding that names are are not resolving to their new locations (this happened to me today), flushing the local DNS resolver cache may help (if not, you probably have to wait for DNS propagation or you configured something incorrectly). I only needed to do this on a Windows server, but I decided to dig a bit deeper to find out how to do this on other systems as well.

On Windows:

ipconfig /flushdns

On Linux it’s a bit more difficult and not as simple as ifconfig /flushdns. You can try to restart the nscd daemon (note the path may be different depending on the distro):

/etc/rc.d/init.d/nscd restart

However, nscd may not be installed on some distros (e.g. Ubuntu) and applications (e.g. Firefox) may keep their own cache. So you’ll need to restart the application in such cases. If your desperate, you can also restart the entire networking subsystem:

/etc/rc.d/init.d/networking restart

On OS X, Leopard and higher

dscacheutil -flushcache

On OS X, Tiger and lower

lookupd -flushcache