Linux 101 : The NetworkManager, the unmanaged devices and the nmcli tool



The NetworkManager is a tool that manages the network devices on a system.
The devices that are not managed by the NetworkManager are called "unmanaged" devices.

The nmcli command and the unmanaged devices:

We could use the "nmcli" command to see the "unmanaged" devices:


Remark:

The interfaces defined in "/etc/network/interfaces" file are not handled by the NetworkManager.

How to set a device as "unmanaged":

To turn a device into an "unmanaged" device, we list it in the "/etc/network/interfaces" file, then we set the below parameters in the "/etc/NetworkManager/NetworkManager.conf" file:


Allowing the Network Manager to handle the devices: 

To make the NetworkManager handle a device, we list the interface in the "/etc/network/interfaces" file and we set in the "/etc/NetworkManager/NetworkManager.conf " file the "managed" parameter:


Then, we would need to restart the NetworkManager for the changes to take effect:


Setting the device to "unmanaged" using the nmcli tool:

We can set a device to unmanaged using the "nmcli" command as below:


For these changes to persist beyond reboots, we would need to follow the steps described above.

Example:


We then set the device to "unmanaged".


Then we get the below:


The /etc/network/interfaces:

Below is an example of the "/etc/network/interfaces" file:


We can use the ifup and ifdown command to bring an interface (mentioned in the "interface" file) up or down.
Below is the location where we can put the script than we want the system to run before and after bringing up an interface respectively:
  • /etc/network/if-pre-up.d/
  • /etc/network/if-up.d/ 
Below is the location where we can put the scripts that the system runs before and after bringing down an interface:
  • /etc/network/if-down.d/
  • /etc/network/if-post-down.d/

Comments

Leave as a comment:

Archive