In v18.04 of Ubuntu Server you need to use Netplan to set a static IP.
** don’t use tabs for indentation, yaml doesn’t like tabs **
sudo cp /etc/netplan/<filename> /etc/netplan/<filename>.bak
sudo nano /etc/netplan/<filename>
network: ethernets: eth0: addresses: [] gateway4: dhcp4: no nameservers: addresses: [1.1.1.1,1.0.0.1] optional: true version: 2
Now press Ctrl + O then Ctrl + X
sudo netplan apply
Your static IP is now configured.