Ubuntu 20.04 doesn't have
/etc/network/interfaces and uses
/etc/netplan/<config file>.yaml instead.
.yaml config file is auto generated and can have many names but as long as it has
.yaml extension it should work fine. Mine was
50-cloud-init.yaml on one machine,
00-installer-config.yaml on another.
To set the ip to
You can look up what your current gateway is using
ip route and put that in instead of
Also instead of
eth0 you can have a different name for your network. If so, keep your network's name there.
sudo netplan apply
This kicked me out of SSH because I was SSHed through an old ip. I had to reboot the computer manually. Restarting router is a good idea too at this point to clear possible ip conflicts.
Also I found suggestions to edit the generator of this yaml file in
/etc/cloud but I found no fool-proof docs how to do this. Instead, Canonical provides https://netplan.io/examples with a whole bunch of copy-paste configurations for the
config.yaml file, which seem like a great approach for most cases.