Networking 20.04 Netplan – How to Restore Network Configuration with Netplan on Ubuntu 20.04

20.04netplannetworking

Recently I tried to install open nebula and for some reason,the eno1 network interface disappeared from my Ubuntu 20.04 network configuration and I would like to restore it, because now I'm not able to connect to internet. Ubuntu 20.04 uses netplan. This is my 01-network-manager-all.yaml file:

network:

version: 2

renderer: networkd

ethernets:

eno1:

dhcp4: true

When I do ifconfig, I see these network interfaces:

docker0 : inet 172.17.0.1 ; netmask 255.255.0.0 ; broadcast 172.17.255.255

minione-nic : no inet ; no netmask ; no broadcast

veth03ad024 : no inet ; no netmask ; no broadcast

virbr0 : inet 192.168.122.1 ; netmask 255.255.255.0 ; broadcast 192.168.122.255

virbr0-nic : no inet ; no netmask ; no broadcast ;

I tried to re-create the old eno1 interface with these commands:

sudo netman apply

sudo systemctl restart network-manager

I don't see any identation error, but the situation is not changed. I have no eno1 interface and no connection to internet. What should I do? what's missing?

NB : this is what happened after having followed the @heynnema's original suggestion:

root@ziomario-I5:/etc/netplan# sudo netplan --debug generate

DEBUG:command generate: running ['/lib/netplan/generate']

** (generate:3712): DEBUG: 22:35:25.392: Processing input file 
/etc/netplan/01-network-manager-all.yaml..

** (generate:3712): DEBUG: 22:35:25.392: starting new processing pass

** (generate:3712): DEBUG: 22:35:25.393: We have some netdefs, pass them 

through a final round of validation

** (generate:3712): DEBUG: 22:35:25.393: eno1: setting default backend to 

2

** (generate:3712): DEBUG: 22:35:25.393: Configuration is valid

** (generate:3712): DEBUG: 22:35:25.393: Generating output files..

** (generate:3712): DEBUG: 22:35:25.393: networkd: definition eno1 is not 

for us (backend 2)

(generate:3712): GLib-DEBUG: 22:35:25.393: posix_spawn avoided (fd close 

requested) 

This is the netplan file that I used (01-network-manager-all.yaml) :

# Let NetworkManager manage all devices on this system

network:

  version: 2

  renderer: NetworkManager

  ethernets:

    eno1:

      dhcp4: true

I have also tried this version:

# Let NetworkManager manage all devices on this system

network:

  version: 2

  renderer: NetworkManager

I tried also:

# Let NetworkManager manage all devices on this system

network:

  version: 2

  renderer: networkd

  ethernets:

    eno1:

      dhcp4: true

it says: NetworkManager : definition eno1 is not for us (backend 1)

no eno1 interface has been produced. so it does not work.

root@ziomario-I5:/etc/netplan# sudo lshw -C network

  *-network UNCLAIMED       
       description: Ethernet controller
       product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
       vendor: Realtek Semiconductor Co., Ltd.
       physical id: 0
       bus info: pci@0000:03:00.0
       version: 06
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress msix vpd bus_master cap_list
       configuration: latency=0
       resources: ioport:d000(size=256) memory:d3804000-d3804fff memory:d3800000-d3803fff
  *-network:0
       description: Ethernet interface
       physical id: 2
       logical name: veth91a709d
       serial: 96:ae:1d:67:88:d8
       size: 10Gbit/s
       capabilities: ethernet physical
       configuration: autonegotiation=off broadcast=yes driver=veth driverversion=1.0 duplex=full link=yes multicast=yes port=twisted pair speed=10Gbit/s
  *-network:1
       description: Ethernet interface
       physical id: 3
       logical name: docker0
       serial: 02:42:22:9d:a2:14
       capabilities: ethernet physical
       configuration: broadcast=yes driver=bridge driverversion=2.3 firmware=N/A ip=172.17.0.1 link=yes multicast=yes
  *-network:2
       description: Ethernet interface
       physical id: 4
       logical name: virbr0
       serial: 52:54:00:6b:98:0e
       capabilities: ethernet physical
       configuration: broadcast=yes driver=bridge driverversion=2.3 firmware=N/A ip=192.168.122.1 link=no multicast=yes
  *-network:3 DISABLED
       description: Ethernet interface
       physical id: 5
       logical name: virbr0-nic
       serial: 52:54:00:6b:98:0e
       size: 10Mbit/s
       capabilities: ethernet physical
       configuration: autonegotiation=off broadcast=yes driver=tun driverversion=1.6 duplex=full link=no multicast=yes port=twisted pair speed=10Mbit/s

netplan conf

my /etc/network/interfaces file looks like this…

interfaces(5) file used by ifup(8) and ifdown(8)

auto lo
iface lo inet loopback

dkms status:

bbswitch 0.8 ; 5.4.0-40-generic, x86_64 : installed
bbswitch 0.8 ; 5.4.0-41-generic, x86_64 : installed
bbswitch 0.8 ; 5.4.0-42-generic, x86_64 : installed
virtualbox,6.1.10, 5.4.0-40-generic, x86_64 : installed
virtualbox,6.1.10, 5.4.0-41-generic, x86_64 : installed 
virtualbox,6.1.10, 5.4.0-42-generic, x86_64 : installed

Partial solution : RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller does not work with kernel 5.4.0-42-generic ; it says that the device is unclaimed. Instead,with the kernel 5.4.0-41-generic it worked perfectly. so this is a bug of that kernel version.

Best Answer

Edit your /etc/netplan/01-network-manager-all.yaml to this. Keep the spacing, indentation, and no tabs, exactly as I show it.


For server or systemd-networkd:

network:
  version: 2
  renderer: networkd
  ethernets:
    eth0:
      dhcp4: true

For desktop and NetworkManager:

network:
  version: 2
  renderer: NetworkManager

sudo netplan --debug generate

sudo netplan apply

reboot

Update #1:

I've loaded Ubuntu Live and I saw the eth0 interface and it worked.

Update #2:

RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller does not work with kernel 5.4.0-42-generic ; it says that the device is unclaimed. Instead, with the kernel 5.4.0-41-generic it worked perfectly. so this is a bug of that kernel version.

Update #3:

Installed the r8168-dkms driver, and it works with kernel 5.4.0-42-generic.

Note that the -41 kernel, and the broken -42 kernel, came from enabling the Proposed repository. I'd recommend disabling that repo.

Related Question