Image Missing

Ubuntu changed their network manager to canonical’s netplan and for some reason my installation lost the configuration after installation. Maybe it’s not uncommon and the fix is quite easy, but I didn’t find a step by step tutorial online.

If you find a mistake, or if it’s not up to date anymore, feel free to contact me!

Usually there is a eth0 interface for ethernet cards or something like wlpXsX for wifi cards. lo stands for localhost.

Run the following command to show all installed network interfaces:

ifconfig -a

As I’m on my laptop with no ethernet interface the result looks like this:

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet  netmask
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 2309  bytes 222226 (222.2 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2309  bytes 222226 (222.2 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlp2s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.XX  netmask  broadcast
        inet6 fe80::f791:3b06:336b:5a18  prefixlen 64  scopeid 0x20<link>
        inet6 fdaa:bbcc:ddee:0:8243:9e1a:1523:615c  prefixlen 64  scopeid 0x0<global>
        inet6 fdaa:bbcc:ddee:0:f829:2fd0:c270:2958  prefixlen 64  scopeid 0x0<global>
        inet6 fdaa:bbcc:ddee:0:f54b:5263:841b:e7fe  prefixlen 128  scopeid 0x0<global>
        ether 9c:b6:d0:e2:ea:67  txqueuelen 1000  (Ethernet)
        RX packets 316842  bytes 454039741 (454.0 MB)
        RX errors 0  dropped 1786  overruns 0  frame 0
        TX packets 45017  bytes 6116767 (6.1 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

In this case the wlp2s0 interface shows a valid connection, if you run ifconfig without the -a-parameter and only lo shows up you have to configure the other interfaces. lo should always show up as far as I know. Write down all the interfaces, consider which could be the ethernet interface

Netplan uses .yaml-files to control the network settings. In those yaml-files you can define how you want to connect to the router (gateway). Here I’ll only show how to get a DHCP-connection, more examples are on netplan’s homepage another article on gives examples for static IPs as well.

The netplan config files are under /etc/netplan/and you can show the existing files with this command:

sudo ls /etc/netplan/

There is usually already a file. You can read it with:

sudo cat /etc/netplan/<filename>

If you run a regular Ubuntu Desktop installation you should see something like this:

# Let NetworkManager manage all devices on this system
  version: 2
  renderer: NetworkManager

As written there, NetworkManager takes care of everything. In my Ubuntu Server installation it doesn’t. And the file that you see could be empty or misspelled, it’s easiest to create a new file:

sudo nano /etc/netplan/ethernet_01.yaml

The nano editor opens (nano should be installed, otherwise google for another CLI-editor) and you type the following:

# Netplan configuration
	version 2
	renderer: networkd
			dhcp4: true

Replace eno1 with the interface that you think is the ethernet card!

Save everything with CTRL-x, yes, yes.