Just like computer maintenance, to flush DNS can be useful when troubleshooting network problems or just having a good old computer cleanup.
What is DNS
DNS stands for domain name service. DNS allows your pc to translate a friendly computer name like http://tips4pc.com into numbers that our computer understands. So instead of the computer understanding http://tips4pc.com or www.google.com it will turn that into a unique IP address (Internet Protocol) like 24.33.24.112. Now the computer can take you there.
Every website has it’s own unique IP address and you can view this by using the PING command. See the screenshot below. I typed in ping www.google.com and then pressed enter. Now I can see Google’s IP address.
The average computer user has no idea that the domain names they use to get to websites are actually converted to IP addresses to allow computers and devices to reach their destination.
What is DNS Cache?
Most operating systems store all DNS look-ups in a cache to speed up the connection for future visits to previously visited websites. Therefore rather than asking the computer for the address of a website everytime we visit, the cache stores the translated numbers like a phone book.
Each time a website is requested the DNS provider is queried, unless of course it is already stored in the DNS cache.
3 Reasons Why You Flush DNS Cache
1. Problems Loading a Website
You might try to visit a website that you always visit every day and it does not work or show up. This could be because they have changed their IP address and it does not match the one that is stored in your DNS cache. In this instance, it does help to flush the DNS cache so a new IP address can be recorded for that website.
2. New DNS Server
You might see that your Internet service provider has a very slow DNS server. This means that it takes too long to convert the friendly domain name to an IP address for the computer to understand. In this case you might decide to use a free DNS service such as Open DNS or Google DNS to serve up your websites faster and more efficiently.
If you switch to one of these services, you will need to flush your DNS so you are not using the old data from the cache that already exists. Using the old data when switching DNS services defeats the purpose and you will see no speed increase because you are using old information.
3. Privacy Reasons
Flusing the DNS is very handy when you are using a public computer or a shared computer. This is because it is very easy for anyone to display the DNS cache by using the ipconfig /displaydns command to see which websites are stored in there. This means all the websites that were last visited will be listed. Flushing the DNS cache removes these entries and therefore protects your privacy.
How to Flush DNS Cache
So we understand what DNS is and why we are storing these details, now we are going to flush DNS cache on your computer. Below we have instruction for various operating systems, including most Windows versions and also Mac OSX. The following was sourced from How To: Flush Your Local DNS Cache.
Flush DNS in Windows Vista/Windows 7
- Click on Start, followed by All Programs, and then Accessories.
- Right-click on Command Prompt and choose Run as Administrator.
- In the Command Prompt window type in the following command and press Enter:
ipconfig /flushdns
- If all goes well, which it should, you will see the following confirmation message:
Successfully flushed the DNS Resolver Cache.
Watch this video to see how to flush DNS Cache
Windows XP
- Click on Start, followed by All Programs, and then Accessories.
- Click on Command Prompt.
- In the Command Prompt window type in the following command:
ipconfig /flushdns
- and press Enter. You should see the following confirmation message:
Successfully flushed the DNS Resolver Cache.
Mac OS X 10.5.2 and above
- Click on the Finder icon in your dock. Open your Applications folder.
- Inside the Applications folder, click on Utilities and then Terminal.
- Type the following command in the Terminal window and press Enter:
dscacheutil -flushcache
- Do not be alarmed if you do not receive any kind of response from the Terminal window after running the command. This is normal.
Mac OS X 10.5.1 and below
- Click on the Finder icon in your dock. Open your Applications folder.
- Inside the Applications folder, click on Utilities and then Terminal.
- Type the following command in the Terminal window and press Enter:
lookupd -flushcache
Linux
- Many current Linux distributions do not utilize a local DNS resolver cache like Windows and Mac OS X. If you do not know if your Linux installation is utilizing local DNS caching please see the website for your Linux distribution and look for information regarding default included software.
- One of the most commonly used DNS caching Linux applications is NSCD (Name Service Cachine Daemon).
- If you have NSCD installed you can clear the local DNS cache by running one of the following commands in your favorite terminal/shell application:
nscd -i hosts
– Clear local DNS cache for current user.nscd -I hosts
– Clear local DNS cache for all users.
See More CMD Options for FlushDNS
Open your CMD window and type in ipconfig /help
You will see a list of command switches you can use along with the ipconfig command. See the screenshot below Click on the image to see a larger view.
For example you can display the DNS before you flush it by using this command:
ipconfig /displaydns