What is Netplan?
Netplan is a YAML network configuration abstraction for various backends (NetworkManager, networkd).
It is a utility for easily configuring networking on a system. It can be used by writing a YAML description of the required network interfaces with what they should be configured to do. From this description it will generate the required configuration for a chosen renderer tool.
Netplan reads network configuration from /etc/netplan/*.yaml which are written by administrators, installers, cloud image instantiations, or other OS deployments. During early boot it then generates backend specific configuration files in /run to hand off control of devices to a particular networking daemon.
You need add the ip address details in
If you want to add the ip address,gateway and DNS servers use the following syntax
In the above example enp0s8 is interface name
If you want to add static routes add the following syntax
-- to: 0.0.0.0/0
via: gateway address
Once you add the above syntax you can run the following commands as root to test & activate the configuration
sudo netplan --debug generate
sudo netplan apply
If you want more information related to netplan check this document.