DNS servers are used to convert difficult-to-remember IP addresses into simple domain names. What is it for? It's easier for people to remember one word than a series of numbers. If the PC needs to find out the IP address of a domain, it makes a request to the DNS server. Servers are usually received automatically from the router via DHCP or are set manually. 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. At the moment, NetworkManager is responsible for managing the network configuration in Ubuntu. Right now this file is only a link to the NetworkManager file.
The technique is still relevant, but you can also configure DNS on LiveCD. It is important to take into account that after a reboot, all previously set settings are lost, so you will have to do the same work 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 Parameters":
- In the "Setup method" field, select "Automatically (DHCP, address only)":
Then we see the "DNS Servers" field. In this field, we register 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 all. There is another way to configure - through the console,.
In Ubuntu, an interface that is configured via /etc/network/interfaces.
Looking at the list of network interfaces:
$ ls /sys/class/net/
Open the file for editing, then find the name of your network interface, for example, auto enp0s3, if necessary, add a section
$ sudo vi /etc/network/interfaces
auto enp0s3
iface enp0s3 inet dhcp
Adding a line to the section
$ dns-nameserver 8.8.8.8
We see 8.8.8.8 is the address of your DNS server. However, you will be able to configure it if your DHCP client does not assign its 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 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
To enter the settings, restart the network:
$ sudo systemctl restart networking
It will be good if you reboot your computer. You can open /etc/resolv.conf and see if the new DNS address has been applied:
The article examined how Ubuntu 16.04 DNS is configured via a graphical interface or terminal. It's not that hard.
Apply the discount by inserting the promo code in the special field at checkout: