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?