How to Configure IP Address on Ubuntu using Netplan
This post will show you How to Configure IP Address on Ubuntu using Netplan.
Ubuntu has recently moved to Netplan, So we have to use Netplan for network configuration from Ubuntu 18.04, Ubuntu 20.01 and newer Ubuntu releases too. Netplan is based on YAML based configuration system that makes our network configuration steps very simple and efficient. And also Netplan has replaced old network configuration file /etc/network/interfaces that we previously used for configuring network interfaces on Ubuntu.
Still we have /etc/network/interfaces, but we could see the messages on top of the file like ifupdown has been replaced by netplan.
ifupdown has been replaced by netplan
Also You can watch this tutorial demo video on our YouTube Channel.
Lets get started.

How to Configure IP Address on Ubuntu using Netplan

Netplan Configuration files will be available under /etc/netplan/ directory, all these files should be only created in yaml syntax.
netplan network configuration
There will be a default yaml file and the content will be like this below.
configure ipaddress on ubuntu

Under ethernetes: you can specify each interface names and their network details. If you want to have dynamic ip, then dhcp4 should “yes”, if you want static ip address then we must change dhcp4 value to “no”. and manually you can specify the ip address,subnet,netmask and all

Lets see how to write these network configuration using netplan yaml files and how to get help of netplan examples.
This netplan manual page has lot of informations about all the options with examples where we could find options like, dhcp4, dhp6, gateway4, gateway6, nameserver, addresses, etc,.

$man netplan

Get some examples and related options as per your requirement and make changes on the network yaml files.
Once the changes are modified, Apply the changes.
netplan has two options, netplan try and netplan apply.
netplan try – this command will help you to check syntax error and will give some options with timeout to proceed or not.
netplan apply – this command will apply the changes.
netplan command examples

Both command can be used. Once the changes are applied, make sure to see the output of “ip a” or “ifconfig” command and try to reach the ip address configured from other system over the network.

That’s it. Hope you have got an idea, How to Configure IP Address on Ubuntu using Netplan.