25% off on first invoice for all services*

SPRING SALE

Use coupon

*Offer valid for new customers only

25% off on first invoice for all services*

SPRING SALE

Use coupon

*Offer valid for new customers only

Need help?

Our experts have had an average response time of 11.43 minutes in March 2024 to fix urgent issues.

We will keep your servers stable, secure, and fast at all times for one fixed price.

Manage Networking with NetworkManager in RHEL/CentOS 8

by | Mar 7, 2021

Wondering how to manage Networking with NetworkManager in RHEL? We can help you.

In RHEL and CentOS 8, the NetworkManager daemon manages the networking service to dynamically configure and control network devices and keep connections up and active when they are available.

As part of our Server Management Services, we assist our customers with several NetworkManager queries.

Today, let us see how to manage Networking with NetworkManager in RHEL/CentOS 8

 

Manage Networking with NetworkManager in RHEL

NetworkManager supports easy network setup and management using both command-line interface and graphical user interface tools.

In addition, it provides an API through D-Bus to query and control network configuration, support for configuration flexibility, and much more.

Besides, NetworkManager also supports the use of custom scripts to start or stop other services based on the 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 Network scripts by default and they are deprecated.
  • A minimal installation provides a new version of the ifup and ifdown scripts that call NetworkManager via the nmcli tool.
  • To run the ifup and ifdown scripts, NetworkManager must run.

 

Step1 – Install NetworkManager on RHEL/CentOS 8

If it does not come pre-installed, we can install it with the DNF package manager.

# dnf install NetworkManager

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

 

Step2 – Manage NetworkManager Using Systemctl on RHEL/CentOS 8

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

The following are few useful systemctl commands:

  • Check the status of NetworkManager

We can use these commands to check if NetworkManager is active, enabled, and print runtime status information of the NetworkManager.

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

To start NetworkManager we run:

# systemctl start NetworkManager
  • Stop NetworkManager

In addition, to stop or deactivate the NetworkManager, run:

# systemctl stop NetworkManager
  • Restart NetworkManager

If we make changes to interface configurations files or NetworkManager daemon’s configuration, we can restart to apply the changes.

# systemctl restart NetworkManager
  • Reload NetworkManager

To reload the NetworkManager daemon’s configuration without restarting the service, we run:

# systemctl reload NetworkManager

 

Step3 – Using NetworkManager Tools and Working with ifcfg Files

The NetworkManager supports some tools for users to interact with it, which are:

  • 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 include the nm-connection-editor, control-center, and network connection icon.

To list the devices detected by NetworkManager, we run the nmcli command:

# nmcli device
OR
# nmcli device status

To view all active connections, run:

# 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. We can edit them, for example, to set a static IP address for RHEL/CentOS 8 server.

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

Here is a sample configuration to set a static IP address.

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. Then we reload all connection profiles or restart the NetworkManager for the changes to apply.

# nmcli connection reload
OR
# systemctl restart NetworkManager

 

Step5 – Start or Stop Network Services/Scripts Based on Network Connectivity

On the basis of network connectivity, NetworkManager allows users to execute services (such as NFS, SMB, etc.) or simple scripts.

For example, if we want to automatically mount a remote directory locally with sshfs, mount SMB shares, or mount NFS shares after switching between networks, we want such network services to execute not until NetworkManager is up and running.

This feature is provided by the NetworkManager-dispatcher service. Once the service is running, we can add our scripts to the /etc/NetworkManager/dispatcher.d directory.

All scripts must be executable and writable, and owned by root, for example:

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

The dispatcher scripts will execute in alphabetical order at connection time and in reverse alphabetical order at disconnect times.

 

Step6 – Using Legacy Network Scripts

Network scripts are deprecated in RHEL/CentOS 8 and do not come by default. However, to use it, we have to install the network-scripts package.

# yum install network-scripts

Once installed, this package provides a new version of the ifup and ifdown scripts which call NetworkManager via the nmcli tool.

[Need help with the tools? We are here for you]

 

Conclusion

In short, the NetworkManager daemon manages the networking service to dynamically configure and control network devices and keep connections up and active when they are available.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Categories

Tags

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF