Ubuntu – How to add an address to DNS

dnsnetwork-managernetworking

My system is UbuntuĀ 18.04 (Bionic Beaver).

And I want to add 172.26.5.14 to system DNS addresses.

I searched and found some solutions like:

  • Add to /etc/resolv.conf. But data removed neither system or network-manager restart.

  • Add to /etc/resolvconf/resolv.conf.d/base or /etc/resolvconf/resolv.conf.d/head. It's not working and not shown in the nmcli device show enp0s31f6 | grep IP4.DNS result.

How do I add permanently to DNS servers?

Best Answer

The easiest way is to go to

Settings -> Network -> LAN Interface (Cog Symbol) -> IPv4 Settings (tab) -> Additional DNS Servers

If you must do it from the command line, then you can type:

sudo nmcli con mod enp0s31f6 +ipv4.dns "172.26.5.14"

update with:

sudo nmcli con up "enp0s31f6"
Related Question