Ubuntu 20.04 : unable to resolve host (DNS error)


Edit /etc/resolv.conf
add:

nameserver 8.8.8.8
nameserver 8.8.4.4

  1. Update /etc/systemd/resolved.conf
[Resolve]
DNS=1.1.1.1 8.8.8.8
FallbackDNS=8.8.4.4

  1. Restart system resolved: service systemd-resolved restart
  2. Run systemd-resolve --status

the output should look like this:

Global
         DNS Servers: 1.1.1.1
                      8.8.8.8
...

Stop NetworkManager resets resolv.conf on every reboot

One way to stop Network Manager from adding dns-servers to /etc/resolv.conf file is to do this. So first open the nm conf file /etc/NetworkManager/NetworkManager.conf:

sudo vim /etc/NetworkManager/NetworkManager.conf

And add this to the [main] section:

dns=none

Save and exit.

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *