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.
Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform related Linux Network queries.
In this context, we shall look into How to configure networking with Netplan on Ubuntu.
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.
This article covers how to set up your network interface using Netplan and NMTUI. Setting up the network interfaces is one of the most basic step that every system administrator and server engineers have to do to make it accessible over the network.
Netplan is based on YAML based configuration system that makes configuration process very simple. Netplan has replaced the old configuration file /etc/network/interfaces that we previously used for configuring network interfaces in Ubuntu.
To Restart the network service
1. Once all the configurations are successfully applied, restart the Network-Manager service by running the following command:
$ sudo systemctl restart network-manager
2. If you are using a Ubuntu Server, instead use the following command:
$sudo systemctl restart system-networkd
To Verify IP address
Now to verify if the new configurations are successfully applied, run the following command to verify the IP address:
$ ip a
The Netplan default configuration file is under the directory /etc/netplan.
You can find that using the following command:
$ ls /etc/netplan/
To view the content of Netplan network configuration file, run the following command:
$ cat /etc/netplan/*.yaml