DNS, or Domain Name Server, is a crucial component of the internet infrastructure that translates human-friendly domain names (e.g., www.example.com) into machine-readable IP addresses (e.g., 192.0.2.1). DNS is essential for routing internet traffic to the correct destination, and most internet-based services, including email and file transfer, use DNS in some way.

Usually, Internet Service Providers supply a default DNS for your network. However, you may use a custom or third-party DNS for potentially faster and more reliable service.

You can change the DNS server on Ubuntu through the network settings or by editing a configuration file using the command line.

1. Change DNS Through the GUI Network Settings

To change the network settings, it’s best to log in as an administrator on Ubuntu and follow these steps.

Go to Settings, which you can find in the app drawer. Then, click on the Network tab at the top of the left sidebar.

GUI Network Settings in Ubuntu

You will see your Wired and Wireless network connection in the network settings. Click on the Cog icon next to it to open a popup menu with multiple tabs.

Now, go to the IPv4 tab and make sure the IPv4 Method is set to Automatic (DHCP). Just below that, you’ll see the DNS setting. Toggle off the Automatic button next to it.

IPv4 Settings in the Network Settings in Ubuntu

Add the new DNS server IP addresses in the empty field separated by commas and click Apply. Verify that the IP address is correct and safe, as it is critical to your network and privacy.

If you’re unsure which DNS server to go for, check out this comparison of Google DNS and Cloudflare DNS, which are two of the most popular options. This list of DNS services to protect your family is also pretty useful if your main concern is security.

2. Using the Command Line

If you’re using Linux, you likely prefer doing things through the terminal. So here’s how you can change the DNS on Ubuntu through the command line.

Open the terminal and run:

        sudo nano /etc/resolv.conf
    

This will open the file that contains the current DNS server settings.

Replace the existing nameserver IP address with the new DNS server IP address you want to use. Again, make sure to use a trusted DNS server to stay safe.

change dns server settings using resolv.con

Press Ctrl + O and Enter to save the changes. Then, press Ctrl + X to exit nano.

Restart the networking service by running:

        sudo systemctl restart NetworkManager
    

Now you’ve successfully changed the DNS on Ubuntu using the command line.

Easily Change Your DNS on Ubuntu

Changing DNS on Ubuntu is a simple process that you can do by editing the configuration file in the terminal or through the GUI network settings. Using custom or third-party DNS servers can potentially improve the speed and reliability of internet-based services on Ubuntu.

It is also recommended to be cautious when changing DNS servers, as it can also negatively affect your internet connection if done incorrectly. However, changing your DNS on Linux can prove useful for improving your overall internet experience.