Need Assistance?

In only two hours, with an average response time of 15 minutes, our expert will have your problem sorted out.

Server Trouble?

For a single, all-inclusive fee, we guarantee the continuous reliability, safety, and blazing speed of your servers.

How to Manage Networking with NetworkManager in RHEL/CentOS 8

In RHEL and CentOS 8 is a networking service that is managed by the NetworkManager daemon is used to dynamically configure and control network devices and keep the connections up and active when they are available.

We assist our clients with how to manage Networking with NetworkManager in RHEL/CentOS 8 and several NetworkManager queries as part of our server management services plan.

Manage Networking with NetworkManager in RHEL

NetworkManager comes with numerous benefits that support and manage the network setup by using both the command-line interface and graphical user interface tools. Besides, it will also provide an API through D-bus that will allow controlled network configuration.

.Besides, NetworkManager supports custom scripts to start or stop other services based on connection status.

Few important points about networking in RHEL/CentOS 8:

  • It supports the traditional ifcfg type configurations (eg. ifcfg-eth0, ifcfg-enp0s3).
  • It does not provide default Network scripts
  • A minimal installation provides a new version of the ifup and ifdown scripts that call NetworkManager via the nmcli tool.
  •  NetworkManager must run in order to run the ifup and ifdown scripts

 Step 1

Install NetworkManager on RHEL/CentOS 8

You can install a NetworkManager with the DNF package manager.

# dnf install NetworkManager

 Find the configuration file at /etc/NetworkManager/NetworkManager.conf and additional configuration files can be found in /etc/NetworkManager/.

Step 2

Manage NetworkManager Using Systemctl on RHEL/CentOS 8

In RHEL/CentOS 8 has systemd, services are managed by the systemctl tool.

The following are systemctl commands:

  • To check NetworkManager status

Check NetworkManager is active by using the commands

 Enabling NetworkManager status.

# systemctl is-active NetworkManager
# systemctl is-enabled NetworkManager
# systemctl status NetworkManager
  • Start NetworkManager

To start NetworkManager run the command:

# systemctl start NetworkManager

Stop NetworkManager

Run the command to stop or deactivate NetworkManager

# systemctl stop NetworkManager

Restart NetworkManager

Restart if you have done any changes to interface configurations files. 

# systemctl restart NetworkManager

Reload NetworkManager

Run the command to reload the NetworkManager configuration.

# systemctl reload NetworkManager

Step3 

Using NetworkManager Tools and Working with ifcfg Files

NetworkManager supports tools to interact with users.

  • nmcli – a command-line tool to configure networking.
  • nmtui – a simple curses-based text user interface, to configure and manage network interface connections.
  • Other tools such as nm-connection-editor, network connection icon and control-center.

Run the following commands to list the devices detected by NetworkManager.

# nmcli device
OR
# nmcli device status

Run the command to view all active connections.

# nmcli connection show -a

Step4 

Set Static IP Address on RHEL/CentOS 8

Network interface-specific configuration files are at /etc/sysconfig/network-scripts/ directory. To set a static IP address for RHEL/CentOS 8 server,run the command.

# vi /etc/sysconfig/network-scripts/ifcfg-enp0s3

To set a static IP address this one of the sample configurations.

TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=enp0s3
UUID=e81c46b7-441a-4a63-b695-75d8fe633511
DEVICE=enp0s3
ONBOOT=yes
IPADDR=192.168.0.55
PREFIX=24
GATEWAY=192.168.0.1
DNS1=8.8.8.8
PEERDNS=no

Eventually, save the changes. Later reload all the connection profiles in order to apply the changes.

# nmcli connection reload
OR
# systemctl restart NetworkManager

Step5 

Start or Stop Network Services/Scripts Based on Network Connectivity

Based on network connectivity, NetworkManager allows users to execute services (such as NFS, SMB, etc.) or simple scripts.

This feature is provided by the NetworkManager-dispatcher service. Once it starts running the service you can add scripts to the /etc/NetworkManager/dispatcher.d directory.

All the script must be owned by the root and should be executable and writable

Example:

# chown root:root /etc/NetworkManager/dispatcher.d/10-nfs-mount.sh
# chmod 755 /etc/NetworkManager/dispatcher.d/10-nfs-mount.sh

At the connection time, the scripts will execute in alphabetical order but while disconnecting it will reverse the alphabetic.

Step6 

 Using Legacy Network Script

The deprecated Network script doesn’t come by default in RHEL/CentOS 8.

In order to use it, you can install the network-scripts package.

 # yum install network-scripts

Once it installed, the new package version will provide the ifup and ifdown scripts which call NetworkManager via the nmcli tool.

 Conclusion

In short, the RHEL and CentOS 8 is a networking service that is managed by the NetworkManager daemon is used to dynamically configure and control network devices and keep the connections up and active when they are available.

Liked!! Share the post.

Get Support right now!

Start server management with our 24x7 monitoring and active support team

Can't get what you are looking for?

Available 24x7 for emergency support.