Ubuntu 20.04 DNS Not Resolving

Soldato
Joined
7 Feb 2004
Posts
8,206
Location
North East
Clean install of Ubuntu 20.04 LTS command line on Hyper-V. I've set a static IP and pointed the DNS to 8.8.8.8 in the "01-netcfg.yaml" file as below.

Code:
network:
  version: 2
  renderer: networkd
  ethernets:
    eth0:
      dhcp4: no
      addresses: [staticip/24]
      gateway: routerip
      nameservers:
        addresses: [8.8.8.8]


The static IP seems to work fine, can connect over SSH etc, however, DNS don't seem to resolve - eg apt-get update results in a "Temporary failure resolving" error.

If I edit the nameserver in resolv.conf to 8.8.8.8, DNS work for a very short period of time, then the file seems to revert back to default 127.0.0.53 and it doesn't work again

Any ideas?

DNS was working find on 18.04 and I don't think I've done anything differently. End goal is to point the DNS to my router, which has the DNS configured for pihole - this IP doesn't work either, but sticking with google DNS for now until I get it working.

The DNS on the rest of the network is working fine.
 
Last edited:
This is working for me on 20.04 LTS:

Code:
network:
    ethernets:
        ens160:
            addresses:
            - 192.168.8.3/24
            gateway4: 192.168.8.1
            nameservers:
                addresses:
                - 8.8.8.8
                - 8.8.4.4
                search:
                - mydomain.com
            optional: true
    version: 2
 
Reinstalled from scratch and entered the IP addresses during the installation process. All worked OK. Not sure what went wrong previously, but at least it's sorted now.
 
Reinstalled from scratch and entered the IP addresses during the installation process. All worked OK. Not sure what went wrong previously, but at least it's sorted now.
had this issue before and the install had written hidden character to the config. move the file recreate job done. reported it a few months back.
 
Was the interface "eth0" ? if you do "ip link show" I would have expected it to be in the format of "enpXsY" than eth0 of older days.
 
Back
Top Bottom