The nm-connection-editor command on Linux

NetworkManager manages all network devices and their settings on Linux. A network device is the LAN card, and a connection is the collection of settings the network device needs to connect to the network. NetworkManager offers three utilities for creating and managing connections: nmcli, nmtui, and nm-connection-editor.

nmcli

The nmcli utility uses the CLI interface. It works on all platforms. You can use it on SSH, terminal, and Desktop. It supports all features of the NetworkManager.

nmtui

The nmtui uses a curses-based application. It works on the terminal and desktop. It supports all necessary features of the NetworkManager.

nm-connection-editor

The nm-connection-editor is a GTK-based application similar to the nmtui utility. It works only on the desktop and supports all the essential features needed to add, remove, and modify network connections stored by NetworkManager.

Differences between nmtui and nm-connection-editor

nmtui nm-connection-editor
It is a curses-based application. It is a GTK-based application.
It does not need a GUI environment to run. It needs a GUI environment to run.
You can use it on CLI and GUI. You can use it only on GUI.
It supports all the necessary features of NetworkManager. It supports only essential features of NetworkManager.
You can use it to add new connections, manage existing connections, activate a connection, and change the hostname. You can use it to add new connections and manage existing connections. You can't use it to activate a connection or change the hostname.

Using the nm-connection-editor

The following command starts the nm-connection-editor utility.

#nm-connection-editor

The first screen lists all network devices and their connections. On the left bottom side of the screen, there are three buttons. You can use these buttons to add a new connection, delete an existing connection, or manage an existing connection.

The nm-connection-editor

Adding/creating a new connection

To add a new connection, click the Add button.

Adding a new connection

The utility supports many types of network devices. You can create a connection for any supported device but can only use the connection if that device is available on the system.

Select Ethernet from the list and click Create.

Selecting an ethernet device

The next screen allows us to customize the connection. It has various options organized in tabs. We need to understand the following options for the RHCSA/RHCE exam.

Connection name: - This is the name of the connection.

On the General tab, we have two essential options. These options are the following.

  1. Connect automatically with priority
  2. All users may connect to this network

Let us understand these options in detail.

Connect automatically with priority

You can create multiple connections for a device but only use one at a time. If you select this option on all connections, NetworkManager will automatically pick and use the appropriate connection to connect to the network.

For example, you use your laptop at both the office and home. Both places have Wi-Fi networks. In that case, you can create two connections: one for the home Wi-Fi network and another for the office. NetworkManager will automatically select the appropriate connection based on your location if you choose this option on both connections. When you use the laptop at home, it will use the connection you created for the home Wi-Fi network, and when you use it at the office, it will use the connection you created for the office Wi-Fi network.

If you have multiple connections for a single location, you can use the priority option to decide the order in which NetworkManager should use the connections. NetworkManager first selects the connection with the highest priority. If that connection is unavailable, it selects the second highest priority connection, and so on.

In the LAB environment, we don't need to configure this option. Uncheck this option.

All users may connect to this network

If you select this option, all users can use this connection to connect to the network. If you uncheck this option, only the user creating the connection can use this connection.

Keep this option selected.

General tab

As mentioned earlier, you can create a connection for any supported device, but you can use that connection only if that device exists in the system. We are making a connection for an Ethernet device. We can use this connection only if we assign it to a physical Ethernet device.

On the Ethernet tab, select the Ethernet device from the drop-down.

Ethernet device

A connection requires an IP address to connect to the network. To assign an IPv4 address, click the IPv4 Settings tab.

Click the Method option and select Manual. The manual method allows us to configure an IP address manually. Select DHCP if you want this connection to obtain an IP address from a DHCP server.

Click Add and configure the following IP configuration, and click Save.

IP address 10.0.0.10
Netmask 255.0.0.0
Gateway 10.0.0.1

IP configuration

Use the nmcli connection show command to verify the new connection.

nmcli connection show

NetworkManager saves all connection files in the /etc/sysconfig/network-scripts/ directory. It generates the name for the connection configuration file by using the ifcfg— prefix with the connection name. For example, if a connection name is CustomCon1, the file name will be ifcfg-CustomCon1.

You can also view the connection configuration file to verify the entries of a connection.

Listing connection configuration file

You can set only one connection active at a time. The nm-connection-editor does not have an option to activate the connection. You can use the nm-connection-editor only to create, manage, and delete a connection.

Use the nmcli command or nmtui utility to activate a connection. The following command activates the CustomCon1 connection.

#nmcli connection up CustomCon1

Activating a connection

After activating the connection, Use the ip address show [interface name] command to view the interface's IP configuration.

#ip address show ens160

ip address show

As the above output shows, the interface uses the IP configuration assigned to the CustomCon1 connection.

Modifying/updating/editing a connection

To edit a connection, start the nm-connection-editor utility. Select the connection you want to edit and click the edit button.

Editing a connection

Change the IP address and click Save.

Updating the address

NetworkManager does not actively monitor connection configuration files. If you change in the connection configuration file, you must force NetworkManager to reread it.

You can use the nmcli connection down [connection name] and nmcli connection up [connection name] commands to force NetworkManager to reread the connection configuration file.

Deactivate and activate the connection to force NetworkManager to reread the connection file. Then, use the ip address show command again to verify the change.

Activating and deactivating the connection

Deleting/removing a connection

To delete or remove a connection, start nm-connection-editor. Select the connection you want to delete, click the Delete button, and confirm the delete operation.

Deleting a connection

To verify that the connection has been deleted, we can list all connections again.

Verifying deleted connection

Key points:-

  • The nm-connection-editor is part of NetworkManager.
  • It works only on a Desktop.
  • It supports all the essential features you need to manage interfaces and connections.

ComputerNetworkingNotes Linux Tutorials The nm-connection-editor command on Linux

We do not accept any kind of Guest Post. Except Guest post submission, for any other query (such as adverting opportunity, product advertisement, feedback, suggestion, error reporting and technical issue) or simply just say to hello mail us ComputerNetworkingNotes@gmail.com