Clearing your DNS cache after making some DNS changes helps you get the latest version of your website. This article guides you on everything you’d need to know on DNS cache and how to flush it.
So, let’s take a look.
What’s DNS ?
DNS stands for domain name system, and it’s like the internet’s phone book. The system allows you to connect to websites with human-readable domain names instead of their IP addresses—the unique ID of the website’s server.
Every computer on the internet has a unique numerical ID that helps others computers to identify it. Memorizing these strings of numbers for every website we want to visit could be a big deal.
Domain names solve this problem by using easy-to-remember words to match this IP address. Instead of using 216.58.223.228 to connect to Google, you could easily use its domain name www.google.com.
DNS helps you connect to computers using domain names instead of IP addresses.
Understanding DNS Cache
If DNS is the internet’s phone book, then DNS cache is the internet’s phone book saved in your local computer.
When you visit a website on your browser, it first looks for the DNS information in your computer DNS cache. If the browser finds the information, it uses the DNS cache to connect the website; otherwise, it looks up DNS servers across the internets.
When the browser finds the direction on a DNS server, your computer caches the information and saves it in the local DNS cache for subsequent visits.
Local DNS cache helps a browser quickly find a website anytime you visit by taking the shortest route to finding the DNS information.
Why Flushing DNS Cache Matters ?
Purging your local DNS caches forces the browser to initiate a new DNS server lookup.
Some of what makes this essential includes:
- DNS changes are often slow to update on the local cache – flushing the cache ensures you don’t end up seeing the old website or getting an error message.
- It helps quickly display an updated version of a website after moving to a new host or domain name changes.
- Hackers could poison the DNS (DNS spoofing) to redirect you to a malicious website, so regularly purging the cache helps you stay safe.
- DNS cache could be a target for data collectors.
How to Flush DNS Cache on Local Computers ?
Let’s quickly examine how to purge DNS cache on various computers.
Windows Operating System
Follow these steps to clear DNS cache on Windows computers:
- Hold the Window key and R to open the Run interface.
- Type cmd on the search bar and click OK to open the DOS command window.
- Enter this command on the command prompt ipconfig /flushdns
- Press the Enter key to execute the command.
You’d receive a confirmation message if the cache purge were successful.
Note: don’t type the command together. Put a space between ipconfig and the trailing slash (/), or you’ll receive an error.
macOS
Open the terminal window to clear the local DNS cache on your macOS computers. Click on Applications, open the ‘Utilities’ folders and then launch the Terminal app.
Use these commands to flush the cache:
- For OS X Yosemite v10.10.4 or later, copy and run this command on the terminal sudo killall -HUP mDNSResponder
- For OS X Yosemite v10.10 through v10.10.3: sudo discoveryutil mdnsflushcache
- For OS X Mavericks, Mountain Lion, and Lion: sudo killall -HUP mDNSResponder
- For macOS X Snow Leopard: sudo dscacheutil -flushcache
Enter your admin password in the space provided and hit the Return key to execute the command. Your admin password is the same password you use to log in to your computer.
Unlike Windows, macOS doesn’t send notifications when the process executes. However, you could get audio confirmation by adding, say [input the message you want to receive as audio confirmation] to the command.
Here’s an example:
- sudo killall -HUP mDNSResponder; say dns cleared successfully
The command clears the macOS local DNS cache and gives you a ‘DNS cleared successfully’ voice confirmation message.
Google Chrome Browser
Google Chrome browser maintains its DNS cache, which is different from the cache your local computer operating system collects. If Chrome is your primary browser, you should also clear its DNS cache after purging your computer.
Type this address chrome://net-internals/#dns in the browser address bar to get started.
Click on the ‘Clear host cache button to purge the browser DNS cache.
Wrapping It Up
Clearing the local DNS cache on your computer helps you see an updated version of your website or protect it from vulnerabilities. This guide makes it intuitive. Follow the steps to get started immediately.
Don’t hesitate to contact Scalahosting’s customer service if you need support.