When migrating a website to a new hosting server, it is necessary to change the DNS servers of the domain. For a certain period of time, we can not always get to our website correctly. This is due to the fact that DNS propagation is taking place. Flushing local dns cache may help here - but it's not always the case.
How to clear local DNS cache on Windows?
- Press Windows+R keys together to open Windows command prompt console, end type
cmd
and hit enter. - In new window type
ipconfig /flushdns
and hit enter.
How to clear local DNS cache on MacOS?
- Press CMD+spacebar or press F4 button, and then type
terminal
and hit enter. - Depending on MacOS version, you will need to execute one of bellows command:
- MacOS Sierra, X El Capitan, X Mavericks, X Mountain Lion, or X Lion:
sudo killall -HUP mDNSResponder
- MacOS X Yosemite:
sudo discoveryutil udnsflushcaches
- MacOS X Snow Leopard:
sudo dscacheutil -flushcache
- MacOS X Leopard:
sudo lookupd -flushcache
- MacOS Sierra, X El Capitan, X Mavericks, X Mountain Lion, or X Lion:
How to clear local DNS cache on Linux?
By default, Linux doesn’t cache DNS records. But If you have installed Name Service Caching Daemon (NSCD), then steps below will show you how to flush local DNS cache:
- Open terminal window or console
- Type one of this command depending on distribution you are using:
sudo /etc/init.d/nscd restart
sudo service nscd restart
sudo service nscd reload
sudo systemctl restart nscd