How to flush or clean your DNS cache in Linux Mint or Ubuntu

The Domain Name System (DNS) is the phonebook of the Internet. Humans access information online through domain names, like nytimes.com or espn.com. Web browsers interact through Internet Protocol (IP) addresses. DNS translates domain names to IP addresses so browsers can load Internet resources.

Each device connected to the Internet has a unique IP address that other machines use to find the device. DNS servers eliminate the need for humans to memorize IP addresses such as 192.168.1.1 (in IPv4), or more complex newer alphanumeric IP addresses such as 2400:cb00:2048:1::c629:d7a2 (in IPv6).

What is the DNS cache?

A DNS cache (sometimes called a DNS resolver cache) is a temporary database, maintained by a computer’s operating system, that contains records of all the recent visits and attempted visits to websites and other internet domains.

In other words, a DNS cache is just a memory of recent DNS lookups that your computer can quickly refer to when it’s trying to figure out how to load a website.

Why we need flush or clean DNS cache?

When websites moved from one server to another, its IP address gets changed. Now, it is the responsibility of DNS to resolve the new IP address to allow uninterpreted access to websites. Our systems keep a cache of DNS records, which allows for faster resolution of IP addresses. Once the IP address of a domain is changed, it takes time to update the local cache. In the meantime, your system will not be able to find the web site with that domain name. It will keep looking in an old IP address because of the old DNS cache. In this situation, You need to flush the local DNS cache to get recent data.

How to flush or clean DNS cache?

  1. Open the terminal. Use Ctrl+Alt+T or launch from the dashboard.
  2. In the terminal, type or copy-paste from here:
    sudo /etc/init.d/dns-clean start
  3. Hit enter key on the keyboard.
  4. The system will ask for your sudo password. Enter it and press enter key
DNS cache in Ubuntu or Linux Mint Terminal
Command to flush or clean DNS cache in Ubuntu or Linux Mint in the terminal.

That’s it, we had flush our DNS cache and all website should open.

Leave a Reply

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