There are 2 methods to change DNS on Ubuntu, either through the user interface or via the Terminal. Each method has its own pros and cons.
Changing DNS on Ubuntu
Method 1: Changing DNS on Ubuntu through User Interface
Follow the steps below to modify DNS on Ubuntu through the user interface:
Step 1: Start by opening the Ubuntu System Settings window, then locate and click on
Step 2: Now, on the screen, you will see a list of all nearby network connections and the one you are currently using.
Step 3: Next, locate and click on the settings icon, represented by a gear icon, next to the name of the network you are connected to.
Step 4: On the next window that appears on the screen, find and click on the IPv4 tab.
Step 5: Here, locate and click on the DNS box, enter the DNS server address you want to use.
Note: To use multiple DNS addresses, you must enter commas between them.
Step 6: Finally, click on Apply to implement the changes.
Method 2: Changing DNS on Ubuntu via Terminal
Another way to change DNS on Ubuntu is through the Terminal command line. The advantage of this method is its simplicity and avoids delving into settings as in method 1 above.
The first step is to add the server name (nameserver) to the dnsmasq configuration file. However, since dnsmasq is not installed by default on Ubuntu, we will have to perform additional steps to install dnsmasq. To achieve this:
Open the Terminal and enter the following command:
sudo apt-get install dnsmasq
After installing dnsmasq, the next step is to run the following command to edit the DNS configuration file:
sudo nano /etc/dnsmasq.conf
On the screen displayed, locate the item named 'Add other nameservers here' and replace it with the DNS server address you want to use as shown below:
This way, Mytour has just guided you through 2 methods to change DNS on Ubuntu.
Additionally, if you are using Windows 10, you can also easily change DNS through the following steps.
- See more: How to Change DNS on Win 10