Sponsored Link
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
/etc/netplan/01-netcfg.yaml
file.
Netplan Examples
If you want to add the ip address,gateway and DNS servers use the following syntax
enp0s8:
dhcp4: no
addresses: [192.168.56.10/24]
gateway4: 192.168.56.1
nameservers:
addresses: [8.8.8.8]
In the above example enp0s8 is interface name
If you want to add static routes add the following syntax
routes:
-- to: 0.0.0.0/0
via: gateway address
metric: 1
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.
And how is this better than what we had before?
It isn’t. It is change for the sake of change.