KNOWNHOST KNOWLEDGE BASE

Hosting Question? Find the Solution - Browse our Guides, Articles, and How-To's

How To Clear Your DNS Cache

A domain name system, or DNS, is how all of us access websites. It is the system that makes it possible to use URLs instead of numeric IP addresses. This makes it infinitely easier for potential clients to remember and find your site. Sometimes it requires a need to clear DNS Cache.

In order for our computer to “translate” the URL to the IP address, it must access a DNS server. This process can be slower the first time you access a site, while subsequent searches for the same site may be resolved faster. That is because, once you access a site for the first time, your operating system creates its own cache for that website address. 

A DNS cache stores information in its resource records. These records are useful for speeding up search results but may later cause issues. Clearing the browser cache is not enough – you need to flush the DNS cache. 

How to Flush Your DNS Cache

Since DNS cache stores the requests you make locally, when changes are made to a website’s settings, your information may be outdated. To solve this issue, you can flush your DNS cache on your operating system.

To clear your DNS cache, please follow the appropriate procedure below.

For Windows operating systems

  1. Click: Start, Run, then type: “cmd” and press Enter
  2. When the command prompt opens, type: “ipconfig /flushdns” and then press Enter
  3. Your DNS cache is now fully clear

For Mac OS X operating systems

  1. Open up a terminal window by clicking Applications, Utilities, and then Terminal
  2. At the command prompt, type one of these commands depending on your version:
  • For OS X Yosemite v10.10.4 or later, type:

sudo killall -HUP mDNSResponder

  • For OS X Yosemite v10.10 through v10.10.3, type:

sudo discoveryutil mdnsflushcache

  • For OS X Mavericks, Mountain Lion, and Lion, type:

sudo killall -HUP mDNSResponder

  • For Mac OS X Snow Leopard, type:

sudo dscacheutil -flushcache

  1. Now, your DNS cache has been fully cleared

Linux operating systems

Most Linux systems do not have operating-system level DNS caching. This would require a caching service such as Resolved or Nscd. These are not default on Linux installations. Should you be running these for whatever reason, here’s how you clear their cache.

Systemd Resolved

Modern Linux distributions utilize systemd to handle cache entries. This service is called ‘systemd-resolve’ and is present on Ubuntu 18.04.

To see if this is running on your Linux environment, run the following command:

sudo systemctl is-active systemd-resolved.service

Should this service be running, the above command will display “active”. If not, you’ll see “inactive”.

If it’s running, you can execute the following command to clear the cache.

sudo systemd-resolve --flush-caches

A successful command doesn’t return any messages.

Google Chrome browser

  1. Open Google Chrome
  2. Type: chrome://net-internals/#dns in the address bar
  3. Click: Clear host cache
  4. Click on your URL bar and type: chrome://net-internals/#sockets
  5. Click: Close idle sockets, and finally click: Flush socket pools

Firefox Browser

  1. Open FireFox
  2. Type: about:networking#dns in the address bar
  3. Click: Clear DNS Cache
  4. That’s it.

Why Flush a DNS Cache

There are several reasons why it’s important to flush your DNS cache regularly:

  1. Your cache may contain outdated information that keeps you from getting the correct information or accessing websites or applications
  2. You’ve changed DNS and need to see it update.
  3. There is a way for cybercriminals to gain access to your information through cache alteration known as “DNS poisoning” or “DNS spoofing,” so for your own security it’s best to flush your information regularly

Conclusion

Flushing the cache is a great way to force DNS updates to view your website changes quicker or if you’ve adjusted DNS records. Clearing your cache is easy when you follow the steps above, and KnownHost is here to help you with your other web hosting needs and questions.

KnownHost offers 365 days a year, 24 hours a day, all 7 days of the week best in class technical support. A dedicated team is ready to help you should you need our assistance. You’re not using KnownHost for the best web hosting experience? Well, why not? Check with our Sales team to see what can KnownHost do for you in improving your web hosting experience.