Nixgeek

Random Ramblings

Sat 17 January 2015

How to clear DNS cache in various OS

Posted by Daevien in tips   

There are a variety of reasons why (updated a DNS record, issues with resolver, etc) but sometimes a good diagnostic step is to clear out the dns cache.

Each operating system (and even versions / distributions in some cases) have a different method

OSX 10.10

sudo discoveryutil udnsflushcaches

OSX 10.9

dscacheutil -flushcache; sudo killall -HUP mDNSResponder

OSX 10.7 – 10.8

sudo killall -HUP mDNSResponder

OSX 10.5 – 10.6

sudo dscacheutil -flushcache

Windows

ipconfig /flushdns

Linux - There are many different distros and versions here, but one of the following should work

/etc/init.d/named restart

/etc/init.d/nscd restart

service nscd reload

sudo /etc/init.d/dnsmasq restart

service dnsmasq restart

Comments