Network settings play the most important and the founding role in any server configuration. In this article we are going to show you the use of two most important and commonly used utilities in Linux systems that is NMTUI and NETPLAN.
Using both these utilities you can configure the network settings by assigning the right IP, subnet mask and the Gateway.
NMTUI (Network Manager Text User Interface) is an alternative to NMCLI (Network Manager Command Line Interface). Whereas Netplan is a Linux command-line utility that uses YAML descriptive files to configure network interfaces.
In this context, we shall look into How to configure networking with Netplan on Ubuntu.
How to perform Network configuration using Netplan ?
To begin with this Configuration procedure, ensure that you have a Linux system running a Debian or RHEL Operating System with sudo rights.
Then, follow the steps provided below.
1. System Login
Start by logging into your system. You want to configure its network interface using NMTUI or Netplan on a Debian system which is Ubuntu in our case.
Open its shell terminal or connect to its console from your host server.
2. Check Network Interface
To check the network interface we are going to make use the 'ifconfig' or 'ip' command as below:
# ip a
Here you will see the detail of its interface so in the next step we are going to assign an IP to this interface.
3. Assign IP Using Netplan
Netplan utility come by default in Ubuntu 20 LTS, so we just need to configure it using its configuration file.
i. Open its network interface .yaml configuration file using any of your favorite editor to add its required parameters in YAML Format.
# vim /etc/netplan0/00-installer-config.yaml
# This is the network config written by 'subiquity'
addresses: [126.96.36.199, 188.8.131.52]
ii. Save and close the file using ':wq!' and then run the 'netplan apply' command to make the configuration effective.
Here you can see that its network interface is up with our assigned IP address.
To know more about using the netplan you can make use of its help parameters:
# netplan –help
usage: /usr/sbin/netplan [-h] [–debug] …
Network configuration in YAML
-h, –help show this help message and exit
–debug Enable debug messages
help Show this help message
apply Apply current netplan config to running system
generate Generate backend specific configuration files from /etc/netplan/*.yaml
info Show current netplan version and available features
ip Retrieve IP information from the system
try Try to apply a new netplan config to running system, with automatic rollback
4. Assign IP using NMTUI
NMTUI is an alternative tool to configure network interfaces on a Linux systems, it stands for Network Manager Text User Interface.
It available on default repository of RHEL/CentOS 7 and later version but if you are using Ubuntu 20 LTS like in our case then you have to install it first.
To install NMTUI on Ubuntu run the command below on your terminal:
# apt install network-manager
After installation, run the below command to run this on your system and its interface will pop up:
Here, you can edit or activate any other connection interface as well as set the system hostname.
Let go for Edit connection to configure your IPv4 configurations as per your network addresses.
Make sure to check automatically connect option and then select 'OK' to save the changes.
To apply the made changes run the command below to restart your network services.
# systemctl restart network
And that's it, check your IP status and it should be assigned to your connected interface.