What is Netplan?
Ubuntu systems are now using netplan for the network configuration. Netplan enables easily configuring networking on a system via YAML files. Netplan processes the YAML and generates the required configurations for either NetworkManager or systemd-network the system’s renderer.
This new tool replaces the static interfaces (/etc/network/interfaces) file that had previously been used to configure Ubuntu network interfaces. Now you must use /etc/netplan/*.yaml to configure Ubuntu interfaces.
The new interfaces configuration file now lives in the /etc/netplan directory. There are two renderers. NetworkManager and networkd. Use NetworkManager renderer for desktop computers manage through GUI and networkd is used for server to manage from the console.
The Desktop users can easily add or modify IP address using GUI interface. Read this tutorial to configure IP address on Ubuntu 18.04 Desktop.
Setup Static IP on Ubuntu 18.04
First of all, check the network interface name on your system using ifconfig command. In my case, the network interface name is “enp0s3”.
Now edit the following file.
sudo nano /etc/netplan/01-netcfg.yaml
Add below content to file with your address and gateway details:
Save the file and apply the new settings to networkd by executing command:
sudo netplan apply
Your system is configured with an updated IP address. To view current IP of system use one of the below commands:
sudo ifconfig sudo ip addr show