0

I migrated from Ubuntu 16 to 18.04, and now my Internet connectivity is broken. Problem seems to be that 18.04 is using netplan and it wasn't properly configured.

The file /etc/network/interfaces only contains the loopback device:

auto lo
iface lo inet loopback

All the other entries are commented out (probably by an installer script).

The directory /etc/netplan/ was empty. I created a 01-netcfg.yaml with the following contents:

network:
  version: 2
  renderer: networkd
  ethernets:
    eth0:
      dhcp4: yes
      dhcp6: no
      # addresses: []
      gateway4: xxx.xx.xx.xxx
      nameservers:
        addresses: [xxx.xx.xx.xx, xxx.xx.xx.xx]
        addresses: [8.8.8.8, 8.8.4.4]

The command sudo netplan --debug apply reveals the following interesting lines:

NetworkManager: definition eth0 is not for us (backend 1)
DEBUG: eth0 not found in {}

While looking for solutions, I found that most people don't use eth0 in their yaml definition, but something like enp2s0. Howerver, the command ifconfig shows only the two interfaces, eth0 and lo. Same with ip addr show.

Any ideas?

  • 1
    Is this a server system or a desktop system? if the latter, your interface is likely being rendered by NetworkManager already (hence "not for us") – steeldriver Jul 9 at 13:25
  • It's a desktop system. I tried using renderer: NetworkManager also, but it didn't help. – digory doo Jul 9 at 13:26
  • For reference, what do you see if you run dmesg|grep eth0 ? Are there any renamed from eth0 lines ? Also, what's the output of sudo journalctl -xeu networkd and of sudo journalctl -xeu NetworkManager ? You may need to change the resolveer to NetworkManager as that's probably still be default since your upgrade from 16.04 – taifwa Jul 9 at 13:27
  • Eth0 was not renamed. The output from journalctl is empty. How do I change the resolveer? – digory doo Jul 9 at 13:29
  • Sorry - renderer. But I see you already tried that. No typos when you tried, I take it.... – taifwa Jul 9 at 13:30
1

Your /etc/network/interfaces looks fine.

Change your /etc/netplan/01-netcfg.yaml to the following code (and only this)... using sudo -H gedit /etc/netplan/01-netcfg.yaml...

network:
  version: 2
  renderer: NetworkManager

Then, in terminal...

sudo netplan --debug generate # generate config files

sudo netplan apply # apply configuration

reboot # reboot the computer

Then use the standard Network Manager GUI to establish a wired/wireless connection.

  • Unfortunately, I was impatient and uninstalled netplan. I'm now back to resolv.conf, which works fine. So, I don't know if your answer would have solved the problem... – digory doo Jul 11 at 6:07
  • @digorydoo if you've resorted to manually editing /etc/resolv.conf then you're still doing it wrong. And by removing a portion of the OS, you've handicapped your system. Best to reinstall netplan and follow my answer. – heynnema Jul 11 at 13:21

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.