Clear DNS Cache in Windows, Linux & Chrome

Clear DNS Cache in Windows, Linux & Chrome

Although the operating systems perform the troubleshooting process automatically, sometimes you have to play a role in these troubleshooting processes manually. Perhaps for many users, especially beginners, troubleshooting the operating system is a difficult responsibility, while by reading several useful educational resources and learning without the need for technical expertise, you can easily fix operating system problems.

The problem of establishing a connection is one of the common problems of Windows and Linux operating systems users. The problem of connecting to the Internet or the server and encountering the HTTP error that you receive from the server will require troubleshooting, which clearing the DNS cache is one of the solutions to solve the connection problem. Disturbances in the connection can have various reasons such as technical problems of the system, failure, etc., but clearing the DNS cache is one of the most efficient and convenient solutions without the need for technical knowledge. Now you may ask yourself, why should we flush the DNS Cache? How do we flush DNS Cache? We will answer all these questions in this article.

In this tutorial, we will introduce you to DNS Cache and explain the reasons for flushing the DNS cache. Since the way to flush DNS Cache is different in Linux and Windows operating systems, we will teach you how to flush DNS Cache in various versions of Linux and Windows operating systems and even Chrome browsers.

In addition to the users of Linux and Windows operating systems, this article is important for users who buy a VPS and use it to host websites, because by learning how to flush the DNS cache, they can easily and quickly solve the problem of their connections and Fix other problems related to DNS performance. So don’t miss reading this article.

Familiarity with DNS

We know that by reading our previous articles, you are now aware of what DNS is and its function, but in this tutorial, we will explain what DNS is for users who have not read our previous articles. DNS stands for Domain Name System, which is known as a technology standard for managing the names of websites and domains on the Internet and It contains a list of registered websites on the Internet and their IP addresses.

If we want to explain more fully, to create each website, a name is determined for its domain name, which is unique to that site. When entering the domain name of a website in the URL of the browser, DNS translates it into an IP address to direct users to the desired site that they intend to visit. Therefore, DNS contains a list of IP addresses of websites on the Internet.

Without DNS, users would not be able to access any website by entering its domain name, as it would be impossible to access a domain name without translating it to its unique IP address. DNS defines a specific pin for each hostname to identify the location of each hostname more easily and quickly refer users to the desired site.

What is DNS Cache?

Operating systems and browsers store data, DNS records, and IP addresses of sites that you have already searched in a database called DNS Cache, so that speed up the response of the DNS server to the requests and the loading of the information of the websites that you have already visited. Also, in this way, it can save resources on the network and improve the web experience.

The DNS Cache process is performed for your most visited websites and its purpose is to save your time in accessing the desired website. Because without DNS Cache, you would have to wait a long time to search for your most visited website, so that DNS can perform its tasks to provide your desired site; While the browser and the operating system save the information of the desired site in the DNS Cache, after your search, instead of the usual operation and asking the DNS Servers, it searches the information in the cache and loads it without wasting time.

Reasons for flushing DNS Cache

DNS Cache, along with its advantages, can sometimes cause security problems and technical problems such as internet connection disruptions or data privacy problems that can provide the basis for abusers and Phishing attacks. For this reason, the first and simplest solution you can use to solve such problems is to clear the DNS Cache. In the following, We will further explain the reasons for clearing the DNS cache.

  • Fix security problems

Since the DNS cache contains the IP addresses of sites you have visited frequently, it can be a useful resource for phishing attacks and cyber fraudsters to exploit; Because if DNS Cache is accessed, they can change the saved IP addresses and redirect you to invalid and wrong sites and misuse your personal and important information such as passwords for personal user accounts, input information for the banking system, etc.

On the other hand, another security issue in this field is the existence of some dangerous and malicious IPs that cause problems in the performance and speed of the network connection.

  • Protecting data privacy and user behavior on the Internet

Most likely, by now you have become aware of the trick of marketing and advertising companies when studying different websites. When reading some sites, cookies and third-party tools try to identify user behavior, one of the useful techniques for advertising companies to recognize user behavior is access to user search history. Since DNS Cache determines to some extent the online behavior of users, it can be an important source for abusive people.

While the search history of each person should have privacy and the possibility of accessing the user’s search history can bring unpleasant consequences. Flushing DNS Cache is one of the effective ways to improve security in the described conditions.

  • Not getting 404 error

The 404 error may be familiar to many users, as most users have experienced this error when searching for an IP address or clicking on a link. Receiving a 404 error can have various reasons, but in most cases, this error can be resolved by flushing the DNS Cache. Why do you think flushing the DNS cache can solve the 404 error problem when searching for a specific IP?

Since the DNS Cache contains old information of sites, if a site’s domain name changes or a site is transferred to a new host, you may encounter a 404 error when searching for the site’s IP address; because the DNS Cache information has not been updated yet and it will take some time for the information stored in the DNS Cache to be updated. To solve the problem immediately, the best solution is to flush the DNS cache.

  • Solving the problem of accessing the site

It has probably happened to you that sometimes a website does not load for you, you are looking for a solution to solve this problem, this problem also has various reasons. To solve this problem, solutions such as clearing browser cookies, allowing sites to store cookies and read them, and setting the browser to disable blockers should be prioritized, and if your problem is not solved, flush the DNS Cache. flushing the DNS cache in most cases solves this problem and you can access various sites without restrictions.

Flush DNS Cache in Windows, Linux, and Chrome browser

The process of flushing the DNS cache is not complicated; without the need for technical knowledge, you can easily flush the DNS cache in the operating system you are using. The only point is that flushing the DNS Cache is not the same process in all operating systems, so we will teach how to flush the DNS Cache on different versions of the Windows operating system, Linux distributions, and even the Chrome browser.

Steps to flush DNS Cache in Windows

In the following, we will provide the necessary instructions for flushing the DNS Cache in Windows 7, 8, 10, 11, Vista, and XP.

clearing DNS Cache in Windows

  • Clearing DNS Cache in Windows 10/11

DNS Cache can be flushed in Windows by running commands in the command line interface. Follow the steps below to clear DNS Cache in Windows 10/11:

  1. To open the command line interface, click on the Start icon (Windows icon) in the left corner of the TaskBar.
  2. In the menu that opens, scroll to find Windows Systems and click on it to select the Command Prompt option.

how to flush DNS Cache in Windows10

Note: In addition to the method we explained, you can access the command line interface by pressing the Windows + R buttons simultaneously and then typing cmd in the opened window. (This is the most common way to access the command line interface in Windows 11.)

  1. After accessing the command line interface, you may encounter a message that asks you to allow changes to be made on your computer after making changes in the command line interface, select Yes as the answer.

Note: At this step, you may need information for administrative login. If you are not the system administrator, you should contact the system administrator.

  1. After accessing the command line interface, enter the following command to flush DNS Cache in Windows 10/11:
ipconfig /flushdns
  1. After typing the above command, press the Enter button.
  2. If the DNS Cache clearing process is successful, you will receive the following message:
Successfully flushed the DNS Resolver cache.

After receiving the above message and ensuring the DNS Cache is cleared, you can close the Command Prompt window.

  • Clearing DNS Cache in Windows 8

In different versions of Windows, the command you run to flush the DNS cache is the same. (The command isipconfig /flushdns.) The difference between the DNS Cache flushing process in old and new versions of Windows is in the way to access the Command Prompt.There are two ways to access the command line interface in Windows 8:

  • First method: Press the WIN + X buttons Simultaneously and select the Command Prompt option.
  • Second method: Select the Start button(Windows icon), then by referring to the Apps screen, find Windows Systems on the right side and click on it, and finally click on Command Prompt. The summary of the steps is as follows:

App screen > Windows Systems > Command Prompt

After the Command Prompt window opens, similar to the DNS Cache flushing process in Windows 10/11, run the following command:

ipconfig /flushdns

After receiving the confirmation message, make sure that the DNS Cache has been flushed successfully in Windows 8.

  • Clearing DNS Cache in Windows 7, XP, and Vista

The process of flushing DNS Cache in Windows 7, Windows XP, and Vista is similar to other versions of Windows, but to access the command line interface, you must follow the steps below:

  1. Click on the Windows logo in the left corner of the Taskbar.
  2. Then click on All Programs > Accessories respectively.
  3. Then find Command Prompt and click on it.
  4. In the Command Prompt window, execute the commandipconfig /flushdns.
  5. Then press the Enter button.

Finally, the display of the confirmation message indicates the successful completion of the DNS Cache clearing process.

In Windows Vista, after executing the desired command, you may receive the message “Action Requires Elevation“, in which case, you will need the intervention of the Windows system administrator and communicate with it in order to complete the DNS Cache clearing process.

Steps to flush DNS Cache in Linux

The process of clearing the DNS Cache in Linux is also simple. In the Linux operating system, DNS Cache is not supported by default, and each Linux distribution may use a different DNS service to store DNS records, so clearing the DNS cache has different commands and steps based on the type of DNS service and the Linux distribution.

flushing DNS Cache in Linux

  • Clearing DNS cache in Ubuntu

To clear the DNS Cache on the Ubuntu operating system and its derivatives, you need to access the Linux terminal with Sudo privileges. For this purpose, you can select Activities in the upper left corner of your desktop, and in the search bar you can enter the terminal environment by typing “terminal” or, use the easiest way to access the command line interface in Linux which is pressing Ctrl+Alt+T simultaneously.

After accessing the Linux terminal, enter the following command:

sudo systemd-resolve --flush-caches

You may be prompted to enter your account password to complete the process of clearing the DNS cache.

Then run the following command to check if the previous command succeeded in clearing the DNS Cache:

sudo systemd-resolve --statistics

To apply changes to the DNS configuration, you must restart the DNS service by running the following command:

sudo systemctl restart bind9.service

Therefore, after stopping and restarting the DNS service, you will receive a confirmation message about the cache was successfully reset.

  • Clearing DNS Cache on Red Hat & CentOS

In operating systems based on Red Hat and CentOS, the following command is used to flush DNS Cache:

  • On the RedHat operating system:
sudo systemctl restart nscd.service
  • On the CentOS operating system:
systemctl restart dnsmasq.service
  • Clearing DNS Cache on other Linux distributions

If the Linux operating system you are running is not Ubuntu, CentOS, RedHat, or their derivatives, you can use the command we provide to clear the DNS cache:

sudo /etc/init.d/dns-clean start

Finally, you were able to clear DNS Cache in Linux distributions so easily.

Flush DNS Cache in Chrome Using chrome://net-internals/#dns

The problem of the internet connecting and accessing websites should be resolved by clearing DNS Cache in your operating system, but if this problem is not solved by performing the previous steps in your operating system, flushing the DNS Cache of your browser can also be useful for solving your connection problem. One of the most used browsers is Google Chrome, for this reason, we will explain how to clear DNS Cache in Google Chrome browser:

  1. Open the Chrome browser.
  2. In the address bar of the browser, type the following IP address:

chrome://net-internals/#dns

  1. Select DNS in the list provided.
  2. Select the Clear host cache option.

Note: If you use Microsoft Edge, use edge://net-internals/#dns.

FAQ

Clearing the DNS cache does not directly affect the internet speed, but clearing the DNS cache regularly is a simple maintenance and repair method that can fix problems in connecting to the internet and is a way to improve browser performance and increase web browsing speed. Note that clearing the DNS cache after accessing the site does not affect the download speed, but adjusting and correcting the router's DNS servers can also be effective in the overall internet speed.

You can access DNS records in Linux by running the following 3 commands:

  • Host Command
  • Dig Command
  • nslookup Command

DNSCache tries to improve browsing on the Internet by storing information about the sites you visit regularly, but in situations where you intend to protect your online behavior and your search history or to solve the problem of accessing a site, flushing the DNS Cache is a useful solution. By doing this, you will clear the online space that is intended to store the information of the sites so that the information and IP address of the sites you visit the most are updated. So don't worry about the insecurity and negative consequences of clearing the DNS cache because there is nothing to worry about.

Conclusion

Clearing the DNS cache, in addition to solving the problem of connecting to the Internet and not being able to access a specific site, provides advantages such as your privacy protection and online behavior, improving security against phishing attacks on your computer, and updating the versions of your most visited websites.

More importantly, you can clear the DNS cache without the need for technical expertise by running a few commands. In this article, we taught how to clear DNS Cache in Windows and Linux operating systems and the Chrome browser, and introduced you to DNS Cache and the reasons for flushing DNS Cache. We hope you enjoyed reading our article and this article will be effective in developing your website and solving your problems.

 

Leave a Reply

Your email address will not be published. Required fields are marked.