DNS servers are used to translate difficult-to-remember IP addresses into simple domain names. Why is this necessary? It is easier for people to memorize a single word than a series of numbers. When a PC needs to know the IP address of a domain, it makes a query to a DNS server. Servers are usually received automatically from the router via DHCP or manually set. Next we will tell you how Ubuntu 16.04 DNS is configured.
Previously, to configure the DNS server used by the system, it was only necessary to enter the addresses of specific servers in the /etc/resolv.conf
file. Currently, Ubuntu NetworkManager is responsible for managing the network configuration in Ubuntu. This file is now only a reference to the NetworkManager file.
The methodology is still valid, but you will also be able to perform DNS configuration on the LiveCD. It is important to take into account that after rebooting, all previously set settings are knocked down, so you will have to do the same job again. To save the settings, you need to perform certain actions through the NetworkManager interface.
Open the context menu and select "Change Connections":
Select your connection and click "Edit":
In the window that opens, select "IPv4 Settings":
In the "Configuration Method" field select "Automatic (DHCP, address only)":
Next we see the "DNS Servers" field. In this field we specify the servers (several addresses separated by commas). You can specify servers from Google:
Now click "Save" and "Close". You can reconnect to the connection, check the current DNS server:
$ nslookup ya.ru
That's it. There is another way to configure - through the console,.
In Ubuntu, the interface that is configured through /etc/network/interfaces
.
See the list of network interfaces:
$ ls /sys/class/net/
Open the file for editing, next find the name of your network interface, for example auto enp0s3
, add a section if necessary
$ sudo vi /etc/network/interfaces
auto enp0s3
iface enp0s3 inet dhcp
Add a line to the section
$ dns-nameserver 8.8.8.8
We see 8.8.8.8.8 - this is the address of your DNS server. However, you will be able to configure it if your DHCP client does not assign the address itself. In the /etc/dhcp/dhclient.conf
file, add a line to specify the DNS address at the DHCP server level:
$ sudo vi /etc/dhcp/dhclient.conf
supersede domain-name-servers 8.8.8.8
The address 8.8.8.8.8 points to the DNS server address. You can add your DNS server addresses to the /etc/resolvconf/resolv.conf.d/base
file:
$ sudo vi /etc/resolvconf/resolv.conf.d/base
nameserver 8.8.8.8
Reboot the network to enter the settings:
$ sudo systemctl restart networking
It will be good if you perform a reboot of the computer. You can open /etc/resolv.conf
and see if the new DNS address has been applied:
This article has covered how to do Ubuntu 16.04 DNS configuration via GUI or terminal. It's not that hard.