1

I've had Ubuntu Server 18.04 up and running for a couple weeks. For a while my network interface never connected. I eventually got a proper netplan YAML file setup. I can now ping my servers IP, not hostname, from another computer on my network and also ping outside IPs, not domain names. As stated I am not able to use any domain names. So, things like ping google.com and sudo apt update fail. I believe it's a DNS issue but am not 100% sure.

Result of ping google.com:

ping: google.com: Temporary failure in name resolution

Result of sudo apt update:

 Err3: http://archive.ubuntu.com/ubuntu bionic InRelease
     Temporary failure in resolving 'archive.ubuntu.com'

There are a few more errors when updating but they all fail to resolve 'archive.ubuntu.com'.

My netplan file is /etc/netplan/01-netcfg.yaml:

network:
  version: 2
  renderer: networkd
  ethernets:
    enp0s25:
      dhcp4: no
      dhcp6: no
      addresses: [192.168.1.40/22]
      gateway4: 192.168.1.1
      nameservers:
        addresses: [8.8.4.4, 8.8.8.8, 1.1.0.0, 1.1.1.1]

I've seen a lot of post and articles talk about /etc/resolv.conf, however mine has always been non-exist. If I would try to cat out the contents I would get an error no such file or directory. I think this is where my problem is but I also do not understand enough about linux networking to realize what's wrong.

Some people were able to fix this issue by creating or fixing their symbolic links to /etc/resolv.conf. However, they used run/systemd/resolve/resolv.conf, /run/resolvconf/resolv.conf, and other files. Those files/services don't exist on my machine. I only have one networking-related file under /run located at /run/systemd/network/10-netplan-enp0s25.network. It's contents are:

[Match]
Name=enp0s25

[Network]
LinkLocalAddressing=ipv6
Address=192.198.1.40/22
Gateway=192.168.1.1
DNS=8.8.4.4
DNS=8.8.8.8
DNS=1.1.0.0
DNS=1.1.1.1

I created a symbolic link from the /etc/resolv.conf to the /run/systemd/network/10-netplan-enp0s25.network. The contents of my resolv.conf are exactly the same as 10-netplan-enp0s25.network.

I am confused by what else needs to be done to configure my machine. Everything I have found so far has been very conflicting and hasn't helped.


  • Do you have /run/systemd/resolve/stub-resolv.conf? In your .yaml, why /22 instead of /24? re: "I created a symbolic link from the /etc/resolv.conf to the /run/systemd/network/10-netplan-enp0s25.network" this is wrong. – heynnema Jun 21 at 13:34
  • @heynnema I do not. I don't even have a /run/systemd/resolve directory. I just saw another config file use /22. I think /24 is what I want though. And I realize my symbolic link was probably wrong but I didn't have anything else to try linking to. – Garrett Hart Jun 21 at 14:16
  • Although it's not the correct thing to do... manually create/edit a /etc/resolv.conf file and add nameserver 127.0.0.53. root ownership. 777 file. Then see if you can resolve FQDN. – heynnema Jun 21 at 14:23
  • @heynnema won't the file be written though? Possible even before a restart? – Garrett Hart Jun 21 at 14:50
  • Since it won't be a symlink, it'll be a static file. Not the final way to run, but just for testing. No restart required. – heynnema Jun 21 at 14:52
0

On an Ubuntu 18.04 system, /etc/resolv.conf should always be a symlink to /run/systemd/resolve/stub-resolv.conf, unless the resolvconf package is installed (not recommended for new systems), in which case it should be a symlink to /run/resolvconf/resolv.conf. If /run/systemd/resolve/stub-resolv.conf does not exist, check that the systemd-resolved service is running (systemctl status systemd-resolved). If it is not active, enable and start it (sudo systemctl enable systemd-resolved && sudo systemctl start systemd-resolved) which should correct the problem.

  • I would note that you might also need to install resolvconf. Or at least I did, I'm not sure if it was absolutely needed or not? – Garrett Hart Jul 1 at 6:06
  • It was not needed. resolvconf is only needed when you are upgrading and have certain types of network configurations set up using ifupdown. – slangasek Jul 2 at 7:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.