How to flush your computer DNS cache
This article was posted in: Web Hosting
When DNS changes are made they occur instantly on our nameservers. However, it may be some time before your computer (or your customer's computers) see the changes. This is because every DNS record has something called a TTL (Time To Live) value. The TTL tells other DNS servers how long to cache a DNS record for before refreshing their local data - it's important because it controls the amount of DNS traffic on the internet.
Normally DNS records are set with a TTL value of 14400 (it's in seconds - so this is 4hrs), but some DNS records have a 24Hr TTL value (86400) so it can take up to a day to see the changes take effect.
The TTL delay is compounded by the fact that your operating system (Windows and Macs) both cache DNS data to reduce the number of requests they make to your ISP. On top of that, web browsers also create a local cache.
The knock on effect is that new DNS data can be delayed even longer.
Clearing Windows' DNS cache
- Windows 7 - open a command prompt (clicking the Start button, entering cmd and pressing )
- Windows 8 - by right clicking the Start screen, and clicking All Apps. Look for the Windows System section, and click on Command Prompt.
Enter the following command (you must be logged in as an administrator) and press the key.
To make sure you are seeing the correct IP addresses for your website, you can see the contents of your local cache with:
Clearing Mac OS X DNS cache
Open the Terminal application from the Applications/Utilities folder or search for it using Spotlight. Depending on which version of Mac OSX you are running, you should type in the following commands, and press the key. You may be asked to enter an administrative username and password - do so, as this is an administrator level task.
For OSX prior to 10.5.1 (Leopard)
sudo lookupd -flushcache
Mac OSX 10.5 and 10.6 (Leopard and Snow Leopard)
sudo dscacheutil -flushcache
You can obtain a full list of all entries in the cache using this command.
sudo dscacheutil -cachedump -entries
Mac OSX 10.7 and 10.8 (Lion and Mountain Lion)
sudo killall -HUP mDNSResponder
Clearing Ubuntu/Linux DNS cache
Open the terminal application and enter this command, and press the key.
sudo /etc/init.d/nscd restart