After moving a website from one server to another, it can be difficult to get the new site to show up immediately even with very low TTL (time to live) times on the DNS server. It’s usually because of DNS cache.
As we have to test with all kinds of OS and different versions, I’ve put together how to flush DNS on each major OS (and even on Google’s tricky Chrome which maintains its own DNS cache) in one place for our own reference.
How to Flush DNS on Windows
Method One: Network Adapter
You can flush and renew your DNS by simply disabling your network adapter and re-enabling it with a right click. You can find your network adapter in the Network and Sharing Center among your Control Panels. If you are having trouble finding it, try the
Start button and typing “Network”. Once there click “Change Adapter Settings”. Look for your active network connection and disable it first and then reenable it via right click.
You may be able to disable and re-enabled your network connection from the task bar, depending on your version of Windows.
Method Two: ipconfig
You have to be running an administrator account. Just open command prompt
Start > Run > RIGHT-CLICK Command Prompt, select “Run As Administrator” and then type the following command to flush the DNS resolver cache when troubleshooting DNS name resolution problems, type:
The following message indicates success:
Windows IP Configuration Successfully flushed the DNS Resolver Cache.
ipconfig works on Windows XP, Server 2003, Vista, 8, 8.1 and 10.
Note: on Windows XP and Windows 10 you do not need to run the ipconfig as administrator.
How to Flush DNS on Mac OS X from 10.2 to 10.11
OS X Yosemite and El Capitan
Use the following Terminal command to reset the DNS cache in OS X v10.10.4 or later and in 10.11:
sudo killall -HUP mDNSResponder
Use the following Terminal command to reset the DNS cache in OS X v10.10 through v10.10.3:
sudo discoveryutil mdnsflushcache
OS X Mavericks, Mountain Lion, and Lion
Use the following Terminal command to reset the DNS cache in OS X 10.7, 10.8 and 10.9:
sudo killall -HUP mDNSResponder
Mac OS X Leopard and Snow Leopard
Use the following Terminal command to reset the DNS cache in OS X v10.5 and v10.6:
sudo dscacheutil -flushcache
Mac OSX 10.4 and below
How to Flush Google Chrome DNS
Google Chrome maintains its own DNS cache on both Windows and Mac. This URL will take you to the Chrome DNS page where you can clear DNS entries:
Once there, just press the “Clear Hosts Cache” button.
I’d suggest simply closing and reopening Chrome instead.
How to flush DNS on Linux
If you’re running Linux you probably know how to flush DNS for your distribution. Here’s how to do it in Ubuntu, Debian and Linux Mint. Start by opening a terminal window. Type:
sudo /etc/init.d/nscd restart
sudo service dns-clean restart
On prompt, type your root password and press enter.
There are several other styles of DNS caching used on Linux such as BIND server and nscd DNS cache, depending on your distribution. Please look at your CentOS, Fedora, RHEL, SUSE or other distribution docs to see which one you should be using.
How to deal with stale ISP cache
Some ISP (in particular, the big US ones in the Western US, like Comcast and Road Runner) only update their own DNS cache every few days or in the worst case once/week. In this case, you should use an alternative DNS server. This is as simple as replacing the automatic DNS entries with manual ones in your network connection.
Two big US ones (who both spy on your browsing for commercial purposes and for government agencies) are Google (126.96.36.199, 188.8.131.52) and OpenDNS (184.108.40.206, 220.127.116.11). Both of these also filter DNS for known malicious requests (some ransomware and trojan sites will be blocked automatically).
To retain your privacy, you should pick the DNS server of a nearby university or alternative ISP with an open DNS server would be better. Make sure it’s one close to you for faster look up speeds. Namebench can help you find one.