If you are having problems on your PC, Laptop or Server getting to a website or another address then your support department may often ask if you have “flushed your DNS cache”. When you go to a website it has two addresses, its domain name i.e.. Test.com and its IP address i.e.. 192.168.1.1, these details are cached to save time looking up the location of the website next time you need to visit.
Occasionally websites and other resources on your network need to change their IP addresses, so when you go to them via the host name (test.com) you cannot get to them because your device has cached the details it needs to get to them. We can quickly resolve this problem by flushing the DNS cache. Obviously there are many different flavours of OS, below I go through the commands on a few of them.
Flush DNS Cache on Windows Server and OS
This is a simple command and is ran from command line.
Flush DNS Cache OSX Mountain Lion and Lion
This is done from terminal (Applications / Utilities):
sudo killall -HUP mDNSResponder
Mac OS X v10.x
sudo dscacheutil -flushcache
Flush DNS Cache Centos, Debian, Ubuntu anf OL5U8
Depending on your flavour of Linux use the commands below.
sudo /etc/init.d/nscd restart OR # service nscd restart OR # service nscd reload OR nscd -i hosts (Clear DNS cache for current user) nscd -I hosts (Clear DNS cache for all users)
Flush DNS Cache on Android
Addresses are cached for 600 seconds (10 minutes) by default in Android. Failed lookups are cached for 10 seconds, there is no command set in the console to flush the DNS, because of this you can either wait the default time outs or go for a hard reboot.
Flush the DNS on an iPad or iPhone – ios 4-8
This is very similar to Android as we have no console access.We have 2 options here to clear dns cache in iOS on your iPad or iPhone, first is reboot and second one is switching to flight mode. Because rebooting takes more time id recommend you use flight mode then re-enable standard mode.
Flush the DNS in Solaris
This is a two step process, first we find the process then we kill it. To find the process run the command:
ps -ef | grep nscd
This will give you back the process id # we thenneed to kill the daemon in order to restart the process
Now on the command line enter the following command with the appropriate id number.
Flush DNS on HP UX
Again this is done via a full service stop and start.
Im sure ive missed tons of OSs here, if you have any other commands then please comment!