How to Find and Change a DNS Server on Linux

Domain Name System (DNS) servers resolve domain names and determine a website’s IP address. This allows you to quickly access any website with a distinctive name. It’s just a phone book for the internet, like saving contacts using the name for mobile phone numbers. It would be difficult to surf the internet without them. Your internet connection becomes unstable if your DNS slows down or becomes unreliable. In this article we will show you how Find and Change Your DNS Server on Linux.

In such cases, you can choose to connect to the Internet on your computer using another DNS, safe and reliable. It may be simpler to modify the DNS settings on your Wi-Fi network so that all devices connected to it can use it. Below we have mentioned the steps to Find and Change Your DNS Server on Linux.

How to Find and Change a DNS Server on Linux

How to Find the Current DNS Server on Linux

The fastest and easiest way to see your current DNS server is to open a terminal and enter the following at the command line:

How to change your DNS server on Linux

The DNS configurations are stored in a file named resolv.conf. Here’s to changing it.

  • Open /etc/resolv.conf in a text editor with sudo privileges.

sudo nano /etc/resolv.conf

  • Add the lines for the Domain name servers you want to use. For example, if you want to use 208.67.222.123 as your DNS, add nameserver 208.67.222.123 to the file.
  • Save resolv.conf. If you are using nano to edit the file, press Ctrl + X and then Y when it asks you to save the file.

Final Words

Some DNS servers can provide faster access times than others. This often depends on how close you are to those servers. If your ISP’s DNS servers are closer to you than Google’s, domain names may resolve faster through your ISP’s default servers than through an external server. If you’re having connection problems and websites don’t seem to be loading, there may be a DNS server error. If the server cannot find the correct IP address associated with the hostname you entered, the website cannot be found and loaded.

I hope you understand this article, How to Find and Change a DNS Server on Linux.

Leave a Comment