How to refresh the DNS cache (Flush DNS)

If you’re having connection issues, you may want to clear your . This may sound like a complicated process, but it is much easier than it sounds.

In fact, flushing the DNS cache does not require any technical knowledge, especially if you have a detailed tutorial to follow.

In this article, you will learn what the DNS Cache is, why you may need to flush it, and the different ways to do so using the flush DNS command.

What is the DNS cache?

Like web browsers, operating systems also store cache files of previous Domain Name System (DNS) lookups in what is called a DNS cache. These are compressed units of information called resource records (RRs) about all websites visited, shown in .

The components of the DNS cache are as follows:

  • resource data: Contains the description of a record, such as the address and host name.
  • Type of register: Describes the type of record (A or AAAA record).
  • Record Name: Shows the domain name of the DNS entry.
  • Time to Live (TTL): The resource record validity time in seconds.
  • Class: The appropriate protocol group from the resource record.
  • data length: refers to the value of the resource data.

When visiting a website for the first time, the user’s operating system stores the DNS cache files for that site. This speeds up the process of resolving domains to their IP addresses, which makes web pages load faster the next time the same IP address is visited.

How to Flush DNS

Depending on your operating system, the steps to refresh the DNS cache may vary. In this tutorial we show you how to do it on Windows, Linux and Mac OS X.

See also  How to Be a Programmer: Take the First Steps in 2022

Microsoft Windows

Refreshing the DNS cache in Microsoft Windows is a relatively easy process. Note that you must run the command line as an administrator to access all system security permissions.

Here are the steps to Flush DNS on Windows XP, 7, Vista, 8, 8.1 and 10.

  1. click on Windows + R or right click on the menu Home -> Run. Write cmd to open the Windows command console. If you don’t already have admin permissions, run the command cmd pressing Ctrl+Shift+Enter.
  2. Write ipconfig /flushdns at the command line and hit enter. This command will clear the DNS cache files on your computer and reset the DNS resolver cache.
  3. If the process works, you will see the following confirmation message on the command line:

Linux

By default, Ubuntu does not cache DNS records. If you manually install a DNS service like NSCD, these steps will show you how to refresh the DNS cache on your computer. Make sure to run these steps as an administrator.

  1. press Ctrl+Alt+T at the same time to open the terminal window.
  2. Enter the following command line to clear the DNS cache files in the subdirectory init.d: sudo /etc/init.d/nscd restart

Etsa is the guide to flushing the DNS cache on a system using systemd.

  1. press the keys Ctrl+Alt+T together to open the terminal window.
  2. Type the following command line: systemd-resolve –flush-caches
  3. Type the following at the command line to check if the above command successfully flushed the DNS cache. systemd-resolve –statistics

Mac OSX

Although the steps to flush the DNS cache on Mac OS X are simple, you need to run the appropriate command based on your current version of OS X.

  1. press the key F4 and then enter terminal in the launchpad search field to open the command terminal.
  2. if you are using Mac OS Sierra, X El Capitan, X-Mavericks, X Mountain Lion either X-Lionyou must enter the following at the command line: sudo killall -HUP mDNSResponder
  3. To flush the DNS cache on Mac OS X Yosemiteenter the command: sudo discoveryutil udnsflushcaches
  4. If you are using Mac OS X Snow Leoparduse the command: sudo dscacheutil -flushcache
  5. For MacOS X Leopard and earlier, enter the following command: sudo lookupd -flushcache
  6. To flush the DNS cache on Mac OS X High Sierraenter this at the command line: sudo killall -HUP mDNSResponder
  7. This is the command to flush the DNS cache on Mac OS X Mojave: sudo killall -HUP mDNSResponder
  8. if you are using MacOS X Catalinause this command: sudo killall -HUP mDNSResponder
  9. This is the command to Flush DNS in Mac OS X Big Sur: sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
See also  How to reduce the load of admin-ajax.php on the server in WordPress

Flush DNS in Google Chrome

Since Google Chrome stores a separate DNS cache from your computer’s operating system, emptying it will have the same benefits. This is especially important if you use Google Chrome as your primary web browser.

Note that this type of cache is different from the browser cache.

Here are the steps to do it:

  1. Open Google Chrome and enter the following address in the address bar chrome://net-internals/#dns
  2. On the internal network settings page, select Clear host cache.

conclusion

When you experience connection problems or see incorrectly displayed web pages, your system may be storing corrupt or outdated DNS cache records. You can quickly resolve this by flushing the DNS cache with one command. If the problem is not resolved, you can refer to this tutorial on .

We hope you find this article helpful in resolving DNS server issues. Good luck!

Gustavo is passionate about creating websites. He focuses on the application of SEO strategies at for Spain and Latin America, as well as the creation of high-level content. When he is not applying new WordPress tricks you can find him playing the guitar, traveling or taking an online course.

Loading Facebook Comments ...
Loading Disqus Comments ...