This post will show you how to set a static IP address on Ubuntu Server 20.04 using the netplan utility.
With Ubuntu Server 20.04 we use the netplan utility to configure a static IP address. Netplan is a new YAML based network configuration tool.
Note: Make sure you note down the name of your network adapter after running the following command.
To get started and configure a static IP address on a server open the netplan directory in the following location.
In the location, you will find a YAML with a name that is different from each system. Open config file (yaml).
In the below example, I am setting a static IP address on my Ubuntu server.
network: version: 2 renderer: networkd ethernets: eth0: dhcp4: no addresses: [192.168.0.2/24] gateway4: 192.168.0.1 nameservers: addresses: [220.127.116.11, 192.168.0.1]
After saving the file, apply the IP configuration using the following command.