Digital Communication


Digital Communication

Change DNS Server in Ubuntu


In Ubuntu, you can change the DNS server with just a few commands through the terminal or just in the operating system’s graphical user interface (GIU). Another way to change the ISP’s default server is through your router settings.

Ubuntu: change the DNS server using network settings

If you are using Ubuntu with a GUI, you can easily use Network Manager to change the DNS server. Here’s how:

Step 1 : Open the operating system settings and select the Network menu. Click the gear symbol to access Network settings.

2nd step : under the tabs IPv4 and/or IPv6, you can enter the DNS server of your choice, always in the corresponding format. If you want to enter multiple alternate servers, separate the addresses with a comma.

Step 3 : for the change of server to take place, cut internet connection in the settings for a moment. After reconnecting to the Internet, the new DNS server should be up and running.

The network settings of the DNS server used in Ubuntu
Thanks to the GUI, you can easily change DNS server in Ubuntu.

Ubuntu: change the DNS server using the terminal

Using a graphical interface is not the only solution, it is also possible to change the DNS server in Ubuntu via the command line. The resolv.conf file is responsible for assigning DNS servers. In theory, you just have to open it and add new nameservers to it. However, the file is managed by the system, so these simple changes will be overwritten on the next reboot. To avoid this, follow these steps:

Step 1 : install the program resolveconf, with which you can overwrite the system’s DNS information. Perform the requested updates.

sudo apt update
sudo apt upgrade
sudo apt install resolvconf


2nd step : after installation, the program should be directly activated. To check if this is the case, use this command:

sudo systemctl status resolvconf.service


The Ubuntu terminal with a code message about the resolvconf service
If the program is running, you will see the code “active”.

If the program is still not activated, you need to run resolvconf manually:

sudo systemctl start resolvconf.service
sudo systemctl enable resolvconf.service
sudo systemctl status resolvconf.service


Step 3 : when resolvconf works, do some changes in the main program file. To do this, open the document with the Nano text editor:

sudo nano /etc/resolvconf/resolv.conf.d/head


Then enter the DNS server you want to use. For example, Google’s DNS server offer is very popular. The search engine service offers two IPv4 addresses.



Now save and close the file.

Step 4 : then you need to update the file responsible for DNS servers, resolv.conf. To do this, use the following commands:

sudo resolvconf --enable-updates
sudo resolvconf -u


Step 5 : for the changes to take effect, restart the affected programs :

sudo systemctl restart resolvconf.service
sudo systemctl restart systemd-resolved.service


You should now be able to see the changes in the resolv.conf file. You can also see there which DNS servers are currently in use. There are different commands for this, depending on the version of Ubuntu you are using.

Ubuntu 18.04 & 20.04 :

systemd-resolve --status


Ubuntu 22.04 :

Change DNS Server in Router

You do not need to modify the operating system to change the DNS servers used: you can also make the settings for name resolution in your router. The advantage is that the modifications are thus reflected directly on all the devices of your network.

To do this, log into the router UI. This is usually done via a URL that you will find in the user manual of the device. The access data should also be in your documents or directly on the router. For example, for a Fritz!Box, the address you enter in the browser is “”. You will also find the option to specify the DNS server in the settings.

DNS settings in the user interface of a Fritz!Box 7590
In the case of a Fritz!Box, you will find the option in the settings to enter other DNS servers.

What is the point of changing DNS server in Ubuntu?

Thanks to the Domain Name System (DNS), it is not necessary to enter IP addresses into the browser to search the Internet. You can simply enter keywords related to Internet addresses and easy to remember. For name resolution, ie translation of URL to IP address, computers use DNS servers. For this, your Internet service provider assigns you a default server, but this is not always the best choice. here are some possible reasons to change DNS server :

  • DNS server not responding: If the DNS server you are using goes down, change the server to another alternative so you can continue to use the Internet.
  • Bypass internet censorship: some countries use DNS to block unwanted websites; an alternative DNS server makes it possible to circumvent this blocking.
  • Improve browsing speed: there are DNS servers that promise particularly fast connections.

Other operating systems also allow changing DNS servers, either with Windows or Linux:

Télécharger notre livre blanc

Comment construire une stratégie de marketing digital ?

Le guide indispensable pour promouvoir votre marque en ligne

En savoir plus

Web Marketing

Overview of the main SEO tools

Andriy OrlovShutterstock Overview of the Best Google SEO Tools If you want to attract as many visitors as possible to your website, you must understand

Souhaitez vous Booster votre Business?

écrivez-nous et restez en contact