sudo dnf install NetworkManager
The main configuration file for NetworkManager is located at /etc/NetworkManager/NetworkManager.conf and additional configuration files can be found in /etc/NetworkManager/.
Managing NetworkManager Using Systemctl on CentOS/RHEL 8
In CentOS/RHEL 8, and other modern Linux systems that have adopted the systemd (system and service manager), services are managed using the systemctl tool. The following are some useful systemctl commands for managing the NetworkManager service.
Checking the status of NetworkManager: A minimal installation of CentOS/RHEL 8 should have NetworkManager started and enabled to automatically start at boot time, by default. You can use the following 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
Starting NetworkManager: If the NetworkManager is not running, you can start it by simply running:
systemctl start NetworkManager
Stopping NetworkManager: To stop or deactivate the NetworkManager for one reason or the other, issue the following command:
systemctl stop NetworkManager
Restarting NetworkManager: To restart or reload the NetworkManager after making some changes in the configuration files, use the following command:
systemctl restart NetworkManager
Enabling or disabling NetworkManager: To enable or disable the NetworkManager service to start or not start automatically at boot time, use the following commands:
systemctl enable NetworkManager systemctl disable NetworkManager
Managing Networking with nmcli Tool on CentOS/RHEL 8
The nmcli tool is a command-line interface for controlling and monitoring the NetworkManager. It allows you to create, modify, delete, activate, deactivate, and display network connections. It also provides information about network devices, connection profiles, VPN connections, Wi-Fi access points, and more. The nmcli tool has a simple syntax as shown below:
nmcli [OPTIONS] OBJECT help
The OPTIONS are optional parameters that modify the behavior of nmcli. The OBJECT is one of the following: general, connection, device, agent, radio, monitor. The COMMAND is a specific action that nmcli performs on the object. The help option displays a brief usage message for nmcli or for a specific object.
Some examples of using nmcli tool are:
To display general information about the network status and configuration:
nmcli general status nmcli general permissions
nmcli general hostname
nmcli general logging
To display information about network devices:
nmcli device status nmcli device show
nmcli device wifi list
nmcli device wifi hotspot
To display information about connection profiles:
nmcli connection show nmcli connection show --active
nmcli connection show id profile-name
nmcli connection show uuid profile-uuid
To create a new connection profile:
nmcli connection add type ethernet ifname eth0 con-name my-eth0 nmcli connection add type wifi ifname wlan0 con-name my-wifi ssid my-ssid
To modify an existing connection profile:
nmcli connection modify id profile-name ipv4.method manual ipv4.addresses 192.168.1.10/24 nmcli connection modify id profile-name ipv4.dns 8.8.8.8
nmcli connection modify id profile-name ipv4.gateway 192.168.1.1
To activate or deactivate a connection profile:
nmcli connection up id profile-name nmcli connection down id profile-name
To delete a connection profile:
nmcli connection delete id profile-name
For more information and examples, you can check the nmcli man page or the online documentation.
Conclusion
In this article, we have learned how to use the NetworkManager service and the nmcli tool to configure and manage network connections on CentOS/RHEL 8 Linux systems. NetworkManager is a powerful and flexible tool that simplifies the network configuration and management tasks. We hope you found this article useful and informative.
References:
[How to Manage Networking with NetworkManager in RHEL/CentOS 8]
[Introduction to NetworkManager Debugging]
[How to Restart Network Service on CentOS 8 or RHEL 8]
[RHEL 8 Deprecated Network Scripts]
a104e7fe7e