Chapter 5. Getting started with managing networking with NetworkManager
5.1. Overview of NetworkManager
Red Hat Enterprise Linux 8 uses the default networking service, NetworkManager, which is a dynamic network control and configuration daemon to keep network devices and connections up and active when they are available. The traditional
ifcfg type configuration files are still supported.
Each network device corresponds to a NetworkManager device. The configuration of a network device is completely stored in a single NetworkManager connection. You can perform a network configuration applying a NetworkManager connection to a NetworkManager device.
5.1.1. Benefits of using NetworkManager
The main benefits of using NetworkManager are:
- Offering an API through D-Bus which allows to query and control network configuration and state. In this way, networking can be checked and configured by multiple applications ensuring a synced and up-to-date networking status. For example, the RHEL web console, which monitors and configures servers through a web browser, uses the NetworkManager D-BUS interface to configure networking, as well as the Gnome GUI, the nmcli and the nm-connection-editor tools. Each change made in one of these tools is detected by all the others.
- Making Network management easier: NetworkManager ensures that network connectivity works. When it detects that there is no network configuration in a system but there are network devices, NetworkManager creates temporary connections to provide connectivity.
- Providing easy setup of connection to the user: NetworkManager offers management through different tools — GUI, nmtui, nmcli.
- Supporting configuration flexibility. For example, configuring a WiFi interface, NetworkManager scans and shows the available wifi networks. You can select an interface, and NetworkManager displays the required credentials providing automatic connection after the reboot process. NetworkManager can configure network aliases, IP addresses, static routes, DNS information, and VPN connections, as well as many connection-specific parameters. You can modify the configuration options to reflect your needs.
- Maintaining the state of devices after the reboot process and taking over interfaces which are set into managed mode during restart.
- Handling devices which are not explicitly set unmanaged but controlled manually by the user or another network service.
5.2. Installing NetworkManager
NetworkManager is installed by default on Red Hat Enterprise Linux 8 . If it is not, enter as
~]# yum install NetworkManager
5.3. Checking the status of NetworkManager
To check whether NetworkManager is running:
~]$ systemctl status NetworkManager NetworkManager.service - Network Manager Loaded: loaded (/lib/systemd/system/NetworkManager.service; enabled) Active: active (running) since Fri, 08 Mar 2013 12:50:04 +0100; 3 days ago
Note that the
systemctl status command displays
Active: inactive (dead) when NetworkManager is not running.
5.4. Starting NetworkManager
To start NetworkManager:
~]# systemctl start NetworkManager
To enable NetworkManager automatically at boot time:
~]# systemctl enable NetworkManager
5.5. NetworkManager tools
Table 5.1. A summary of NetworkManager tools and applications
|Application or Tool||Description|
A command-line tool which enables users and scripts to interact with NetworkManager. Note that nmcli can be used on systems without a GUI such as servers to control all aspects of NetworkManager. It provides a deeper functionality as GUI tools.
A simple curses-based text user interface (TUI) for NetworkManager
A graphical user interface tool for certain tasks not yet handled by the control-center utility such as configuring bonds and teaming connections. You can add, remove, and modify network connections stored by NetworkManager. To start it, enter nm-connection-editor in a terminal.
A graphical user interface tool provided by the GNOME Shell, available for desktop users. It incorporates a Network settings tool. To start it, press the Super key to enter the Activities Overview, type Network and then press Enter. The Network settings tool appears.
network connection icon
A graphical user interface tool provided by the GNOME Shell representing network connection states as reported by NetworkManager. The icon has multiple states that serve as visual indicators for the type of connection you are currently using.
5.6. Running dispatcher scripts
NetworkManager provides a way to run additional custom scripts to start or stop services based on the connection status. By default, the
/etc/NetworkManager/dispatcher.d/ directory exists and NetworkManager runs scripts there, in alphabetical order. Each script must be an executable file owned by
root and must have
write permission only for the file owner.
- For more information about running NetworkManager dispatcher scripts, see the Red Hat Knowledgebase solution How to write a NetworkManager dispatcher script to apply ethtool commands.
5.7. Using NetworkManager with sysconfig files
/etc/sysconfig/ directory is a location for configuration files and scripts. Most network configuration information is stored there, with the exception of VPN, mobile broadband and PPPoE configuration, which are stored in the
/etc/NetworkManager/ subdirectories. For example, interface-specific information is stored in the
ifcfg files in the
Information for VPNs, mobile broadband and PPPoE connections is stored in
In Red Hat Enterprise Linux 8, if you edit an
ifcfg file, NetworkManager is not automatically aware of the change and has to be prompted to notice the change. If you use one of the tools to update NetworkManager profile settings, NetworkManager does not implement those changes until you reconnect using that profile. For example, if configuration files have been changed using an editor, NetworkManager must read the configuration files again.
To ensure this, enter as
root to reload all connection profiles:
~]# nmcli connection reload
Alternatively, to reload only one changed file,
~]# nmcli con load /etc/sysconfig/network-scripts/ifcfg-ifname
Note that you can specify multiple file names using the above command.
To restart the connection after changes are made, use:
~]# nmcli con up connection-name
5.7.1. Legacy network scripts support
Network scripts are deprecated in Red Hat Enterprise Linux 8 and are no longer provided by default. The basic installation provides a new version of the
ifdown scripts which call NetworkManager through the nmcli tool. In Red Hat Enterprise Linux 8, to run the
ifup and the
ifdown scripts, NetworkManager must be running.
Custom commands in
ifdown-local scripts are not executed.
If any of these scripts are required, the installation of the deprecated network scripts in the system is still possible with the following command:
~]# yum install network-scripts
ifup and the
ifdown scripts link to the installed legacy network scripts.
Calling the legacy network scripts shows a warning about their deprecation.
NetworkManager(8)man page — Describes the network management daemon.
NetworkManager.conf(5)man page — Describes the
ifcfgconfiguration files and their directives as understood by the legacy network service.
ifcfg(8)man page — Describes briefly the