Setup a Static IP Address using Nmtui on CentOS 8

On the new version of CentOS 8, there are some major changes related the Networking. For the new version CentOS 8, all configuration related networking is managed by the NetworkManager service. And the NetworkManager provided the TUI (Text User Interface) based application that allows you to create and edit the network configuration, its called 'nmtui'.

Nmtui is a curses-based tui application for interacting with the NetworkManager. The nmtui is a text-based user interface application, can be run on the Terminal shell for managing the NetworkManager.

First, check the 'nmtui' package on the server and make sure it's installed.

rpm -qa | grep NetworkManager

Ensure you get the 'NetworkManager-tui' package on the list.

Check if NetworkManager is installed

The 'nmtui' package has been installed on CentOS 8 server.

Next, check all available interfaces on the system using the following commands.

ifconfig -a

And below is the result.

Ifconfig

You will get two network interfaces 'eth0' and 'eth1'.

And for this guide, we're going to set up the 'eth1' interface with the new static IP address.

To edit the specific interface, you can use the nmtui command as below.

nmtui-edit eth1

Now change the IPv4 configuration as you need.

Use nmtui edit
 
IPv4 Configuration: Manual
Addresses: 192.168.10.100/24
Gateway: 192.168.10.1
DNS servers: 1.1.1.1
             192.168.10.1
Give the 'x' mark on the 'Automatically connect' option

Once all is complete, choose 'OK' and hit the enter button. And the new IP address has been assigned.Advertisements

Next, we need to restart the network interfaces itself for getting the new static IP address.

ifdown eth1
ifup eth1

Activate eth1 network interface

Now check again the 'eth1' interface IP address.

ifconfig eth1

And you will get the 'eth1' interface with a new static IP address '192.168.10.100', as we assigned through the nmtui.

eth1 is up