I hit this issue recently. First the short version:
Run ip a
to find your network devices:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host noprefixroute
valid_lft forever preferred_lft forever
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> ...
lo
is the local loopback interface.- The one starting with
e
(enp1s0
in the example) is the ethernet interface - If you have one starting with
w
it is probably wifi.
(Not cast iron rules, but right 99% of the time in my experience)
Create a file - /etc/netplan/99_default_network.yaml
with the content below - adjusting it to name the network device you have found from the ip a
output:
network:
version: 2
renderer: networkd
ethernets:
enp1s0:
dhcp4: true
Then run
netplan apply
And you should be on the network. With the above file, the network will come up when the machine runs.
For more on netplan, the ubuntu server network docs are decent.