netplan static IP

raspberry pi

/etc/netplan/50-cloud-init.yaml

network:
    ethernets:
        eth0:
            dhcp4: false
            addresses: [<device IP>/24]
            gateway4: <router IP>
            nameservers:
              addresses: [1.1.1.1]
    version: 2

sudo netplan apply

ubuntu server

it's a little different

/etc/netplan/00-installer-config.yaml

network:
    ethernets:
        eth0:
            dhcp4: false
            addresses: [<device IP>/24]
            routes:
	     - to: default
	       via: <router IP>
            nameservers:
              addresses: [1.1.1.1]
    version: 2