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:

  version: 2
  renderer: networkd
      dhcp4: yes
      dhcp6: no
      # addresses: []
      gateway4: xxx.xx.xx.xxx
        addresses: [xxx.xx.xx.xx, xxx.xx.xx.xx]
        addresses: [,]

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 '19 at 13:25
  • It's a desktop system. I tried using renderer: NetworkManager also, but it didn't help. – digory doo Jul 9 '19 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 '19 at 13:27
  • Eth0 was not renamed. The output from journalctl is empty. How do I change the resolveer? – digory doo Jul 9 '19 at 13:29
  • Sorry - renderer. But I see you already tried that. No typos when you tried, I take it.... – taifwa Jul 9 '19 at 13:30

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...

  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.

| improve this answer | |
  • 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 '19 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 '19 at 13:21
  • 2
    This answer states that it's best to go back to the standard Network Manager (GUI). Am I the only one who does not find that satisfying? – Joe Eifert Dec 2 '19 at 13:39
  • @JoeEifert Desktop installations should normally be using NetworkManager. Server installations should use netplan. This user has an 18.04 desktop upgrade installation where netplan isn't working. And the user uninstalled netplan, so why not go back to using the NM GUI? – heynnema Dec 2 '19 at 15:58
  • 1
    @JoeEifert If you read closely, the OP upgraded from Ubuntu 16.xx to 18.04. Ubuntu 16 was a NetworkManager environment. Setting 18.04 back to NM makes it just like they're used to, and it's the way it got installed in a default 18.04 desktop environment. Satisfied yet? – heynnema Dec 8 '19 at 14:43

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.