How to change DNS for Ubuntu, Linux

There are 2 ways to change DNS for Ubuntu, either through the user interface or through Terminal. Each method has its own advantages and disadvantages.

Method 1: Change DNS for Ubuntu from the user interface

Follow the steps below to change DNS for Ubuntu from the user interface:

Step 1: First open the Ubuntu System Settings window , then find and click Network.

How to change DNS for Ubuntu, Linux Picture 1

Step 2: The screen will now display a list of all network connections near you and the network connection you are using.

How to change DNS for Ubuntu, Linux Picture 2

Step 3: Next find and click the settings icon, which is a cog icon, next to the network name you are connecting to.
Step 4: On the next window displayed on the screen, find and click the IPv4 tab.

How to change DNS for Ubuntu, Linux Picture 3

Step 5: Here find and click on the DNS box , enter the DNS server address you want to use in the box.

How to change DNS for Ubuntu, Linux Picture 4

Note: To use multiple DNS addresses, you must enter a comma between the addresses.

Step 6: Finally click Apply to apply the changes.

Method 2: Change DNS for Ubuntu through Terminal

Another way to change DNS on Ubuntu is through the Terminal command window. The advantage of this method is that it is easy to do and does not require digging into the settings like method 1 above.

The first step you need to do is add the nameserver to the dnsmasq configuration file. However, because dnsmasq is not installed on Ubuntu by default, we will have to take the additional step of installing dnsmasq. To do this thing:

Open Terminal and enter the command below:

sudo apt-get install dnsmasq

How to change DNS for Ubuntu, Linux Picture 5

After installing dnsmasq, the next step is to run the command below to edit the DNS configuration file:

sudo nano /etc/dnsmasq.conf

How to change DNS for Ubuntu, Linux Picture 6

On the window displayed on the screen, find the entry named " Add other nameservers here " and replace it with the DNS server address you want to use as shown below:

How to change DNS for Ubuntu, Linux Picture 7

So above, TipsMake has just shown you 2 ways to change DNS for Ubuntu. 


Besides, if you use Windows 10, you can also change DNS in the simplest way through the steps below.

4 ★ | 1 Vote

May be interested

  • How to use DNS over TLS on Ubuntu LinuxHow to use DNS over TLS on Ubuntu Linux
    you can use dns in which all dns queries are processed through the encrypted tls (transport layer secure) protocol. however, most operating systems do not work with dns over tls.
  • 10 new features of Linux Ubuntu 19.0410 new features of Linux Ubuntu 19.04
    the following article summarizes the top 10 new features of ubuntu 19.04 'disco dingo'. let tipsmake.com find out what they are and how much ubuntu 19.04 can surprise you!
  • 5 things to do when installing Ubuntu on PC5 things to do when installing Ubuntu on PC
    ubuntu is a powerful linux distribution suitable for a wide variety of use cases, ideal for both beginners and seasoned linux users.
  • How to Enable Oracle Java in Your Web Browsers on Ubuntu LinuxHow to Enable Oracle Java in Your Web Browsers on Ubuntu Linux
    this document covers enabling 32-bit and 64-bit oracle java browser plugin in 32-bit ubuntu linux and 64-bit ubuntu linux. for the two most popular web browsers for ubuntu linux at this time, which are google chrome and mozilla firefox....
  • Instructions for uninstalling software on UbuntuInstructions for uninstalling software on Ubuntu
    tipsmake.com will guide you how to uninstall the software on a computer running ubuntu linux, as well as how to remove ubuntu from your computer. if your computer runs linux and another operating system simultaneously, you can remove the ubuntu linux partition.
  • Pop! _OS What is it? Is it like Ubuntu?Pop! _OS What is it?  Is it like Ubuntu?
    a few weeks ago, pop! _os was officially released for the first time and available for download. today, we will find out if pop os! _os is cool and compared to ubuntu, it's different.
  • Compare Fedora and UbuntuCompare Fedora and Ubuntu
    fedora and ubuntu are two of the most popular and well-supported linux-based desktop operating systems. so between fedora and ubuntu, which option is right for you?
  • 5 great themes for Ubuntu5 great themes for Ubuntu
    if you often spend a lot of time with your pc, it's easy to understand why you want to add some personal details. on linux, users can often change the theme for the desktop without installing additional software or fearing to spoil anything.
  • Create your own Linux distribution with Ubuntu ImagerCreate your own Linux distribution with Ubuntu Imager
    have you ever wanted to create your own linux distribution but don't know where to start? it's easier than you think. distroshare ubuntu imager creates a live iso that can be installed from an ubuntu or derivative distribution.
  • How to Set Up an FTP Server on Ubuntu LinuxHow to Set Up an FTP Server on Ubuntu Linux
    today's tipsmake will guide you how to set up and connect to an ftp server on a computer running the ubuntu linux operating system. ftp servers are useful for storing data from your computer and allowing others to browse those files. to establish a connection from a computer, you need an ftp server. you also need to update to the latest version of ubuntu.