Photo by Anukrati Omar on Unsplash

Photo by Anukrati Omar on Unsplash

What's New in NetworkManager

The Right Settings

Article from ADMIN 74/2023
The current version of NetworkManager introduces some changes to this de facto standard for configuring the network stack on Linux. We look at the configuration changes you need to make to keep the network running smoothly.

The vast majority of Linux distributions use NetworkManager [1] as the standard tool for configuring the network stack. Even though the systemd-networkd daemon [2] has been a popular alternative for some time, many administrators still appreciate the flexibility that NetworkManager offers. The tool is especially convenient when you use a laptop and switch between different wireless local-area networks (WLANs). Besides a graphical tool that includes an applet for the desktop, you also can configure the service from the shell. This feature also lets you automate the entire network environment setup in the server environment.

ifcfg Files

NetworkManager has always been configured with interface configuration (ifcfg) files. The files contain simple instructions for configuring a network device or more complex profiles for specific network connections. For most Linux distributions, these files are located in the /etc/sysconfig/network-scripts/ or /etc/network/interfaces directory. Ultimately, the plugin you use decides which files NetworkManager accesses – but more about that later. If you are unsure, you can discover the path to the configuration files with the command:

nmcli -f TYPE,FILENAME,NAME conn
TYPE wifi
FILENAME /etc/sysconfig/network-scripts/ifcfg-GrandHotel_Guest
NAME GrandHotel_Guest

A trivial example that configures an Ethernet card named enp0s31f6 as a DHCP client would be:


Listing 1 shows a complete profile for a WLAN connection set up for a network interface card named wlp0s20f3 . The individual configuration options can be found in the /usr/share/doc/init-scripts/sysconfig.txt file or the nm-settings-ifcfg-rh help file.

Listing 1

WLAN Profile


NetworkManager Plugins

NetworkManager supports different formats for configuring network cards and connection profiles. Whereas the ifcfg files only contain simple key-value pairs, the keyfile plugin lets you use files in INI format, too. These files also contain key-value pairs, but the pairs are assigned to specific sections. For an overview of the available sections and the statements allowed, see the nm-settings and nm-settings-keyfile man pages.

You can easily determine which plugins are used in the current configuration of the software with the command:

NetworkManager --print-config

In this example, NetworkManager uses both ifcfg-rh and the keyfile plugins. The global keyfiles are located in the /etc/NetworkManager/system-connections/ directory, but the storage location can differ. The nmcli command again gives you an overview of the configuration files and where they are located (Listing 2).

Listing 2


nmcli -f TYPE,FILENAME,NAME conn
TYPE      FILENAME                                                            NAME
vpn       /etc/NetworkManager/system-connections/HOME-VPN.ovpn                HOME-VPN
wifi      /etc/NetworkManager/system-connections/HOME-Office.nmconnection     HOME-Office
ethernet  /run/NetworkManager/system-connections/enp0s31f6.nmconnection       enp0s31f6

Legacy ifcfg-rh Plugin

Up to now, it's always been the case to use multiple plugins in parallel. More specifically, this means that a configuration in both ifcfg and keyfile format is generated for a single connection profile. However, in the case of a manual change to only one of the two files, the keyfile format is preferred.

Since version 1.38, NetworkManager no longer uses the ifcfg-rh plugin by default, which means that configurations that only exist in the /etc/sysconfig/network-scripts/ directory cannot be read or modified with the native NetworkManager tools such as nmcli, gnome-control-center, or the applet, which applies to the software that accesses the NetworkManager API, as well. If you upgrade to Fedora 36 and have some configuration files in the old ifcfg format, they will be kept when you upgrade, but they will not be reused.

What does that mean in concrete terms? If you have configuration files that only exist in the /etc/sysconfig/network-scripts/ directory but not in /etc/NetworkManager/ system-connections/, you either need to re-enable the ifcfg-rh plugin manually or convert the ifcfg files to keyfile format. Because the use of the keyfile format is far more elegant, you will want it to take priority and will need to migrate older files that only exist in ifcfg format. You easily can do this for all files with the command:

nmcli connection migrate

If you only want to migrate a specific file, simply append the name or UUID of the profile, for example,

nmcli conn migrate GrandHotel_Guest
Connection 'GrandHotel_Guest' (4b0753b1-8994-4ca8-b068-23d5e0f79ebf) successfully migrated.
nmcli -f TYPE,FILENAME,NAME conn | grep GrandHotel_Guest
wifi /etc/NetworkManager/system-connections/GrandHotel_Guest.nmconnection GrandHotel_Guest

to the command.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy ADMIN Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

comments powered by Disqus
Subscribe to our ADMIN Newsletters
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs

Support Our Work

ADMIN content is made possible with support from readers like you. Please consider contributing when you've found an article to be beneficial.

Learn More”>


		<div class=