Understanding Linux Network Manager Fundamental

NetworkManager is a dynamic network control and configuration tool. It was developed in 2004 to simplify network configuration and management for desktop users. Before it, network configuration was static and managed through text files.

Managing configuration via text files was a complex task. You must manually update all related configuration files for every change. Since configuration files had to be updated manually, there was a possibility of errors.

Let us take an example.

You have a laptop. You want to use it at the two locations. The first location has a wired network, while the second has a wireless network. At the first location, you need to use a wired connection. At the second location, you have to use a wireless connection. Since both connections are different, you must update configuration files each time you switch the connection. It makes network management complex and tedious.

NetworkManager solves these issues. It automatically reconfigure network interfaces and routes and authenticate with the wireless network. It dynamically controls all networking devices and their connections. It keeps them up and active when they are available.

It queries the Hardware Abstraction Layer (HAL) at startup to learn about the available network devices, reads their configuration files, and applies the applicable settings. It offers various tools and commands to configure and manage them.

Advantages or benefits of NetworkManager

It makes network management easy. If it detects a network device without a connection, it automatically creates a temporary connection and attaches it to the network device. This feature ensures that network connectivity works.

A connection is a collection of necessary settings (such as an IP address, subnet mask, default gateway, etc.) that a network device (such as an Ethernet card or a Wireless LAN card) uses to connect to the network.

It includes various tools that allow us to configure and manage connections easily. It allows us to configure IP addresses, default gateway, static routes, network aliases, DNS information, VPN connections, and other connection-specific parameters.

It offers an API through D-BUS. Applications can use the API to query and control network configuration and state. For example, through D-BUS, an application checks the current state of an interface and changes it as per requirement.

It can maintain the state of devices after the reboot process. For example, if you change the state of an interface to up and configure NetworkManager to save the state, then NetworkManager will automatically start the interface and change its state to up on the next reboot.

How to install NetworkManager

NetworkManager is part of the default installation. You do not need to install it separately. For any reason, if it is not present or you have uninstalled it, you can use the following command to install it.

# dnf install NetworkManager

default networkmanager

NetworkManager uses the /etc/NetworkManager directory to store configuration files.

listing network manger file

It uses the dispatcher service to track network events and executes the scripts (actions) on the events. You can read the manual pages to learn more about the dispatcher service. The following command displays manual pages for the dispatcher service.

#man 8 NetworkManager-dispatcher

dispatcher

The dispatcher service executes scripts in alphabetical order. It accepts two arguments: the device name for the event and the action.

There are many actions you can perform. The main actions for an interface are the following.

  • pre-up: The interface is connected to the network but not activated yet. It will activate after running this script.
  • up: The interface has been activated.
  • pre-down: It has deactivated the interface but not disconnected it from the network. It will disconnect it after executing this script. In the case of forced disconnections, it will not execute this script.
  • down: The interface has been deactivated.

The vpn-up, vpn-down, vpn-pre-up, or vpn-pre-down are similar to the preceding interfaces but for VPN connections.

Conclusion

NetworkManager is the default utility to manage and monitor network connections on RHEL. It automatically reconfigures network devices when the system changes the network.

ComputerNetworkingNotes Linux Tutorials Understanding Linux Network Manager Fundamental