Chapter 15. Configuring NetworkManager to ignore certain devices
By default, NetworkManager manages all devices. To ignore certain devices, you can configure NetworkManager by setting as unmanaged
.
15.1. Configuring the loopback interface by using nmcli
By default, NetworkManager does not manage the loopback (lo
) interface. After creating a connection profile for the lo
interface, you can configure this device by using NetworkManager. Some of the examples are as follows:
-
Assign additional IP addresses to the
lo
interface - Define DNS addresses
-
Change the Maximum Transmission Unit (MTU) size of the
lo
interface
Procedure
Create a new connection of type
loopback
:# nmcli connection add con-name example-loopback type loopback
Configure custom connection settings, for example:
To assign an additional IP address to the interface, enter:
# nmcli connection modify example-loopback +ipv4.addresses 192.0.2.1/24
NoteNetworkManager manages the
lo
interface by always assigning the IP addresses127.0.0.1
and::1
that are persistent across the reboots. You can not override127.0.0.1
and::1
. However, you can assign additional IP addresses to the interface.To set a custom Maximum Transmission Unit (MTU), enter:
# nmcli con mod example-loopback loopback.mtu 16384
To set an IP address to your DNS server, enter:
# nmcli connection modify example-loopback ipv4.dns 192.0.2.0
If you set a DNS server in the loopback connection profile, this entry is always available in the
/etc/resolv.conf
file. The DNS server entry remains independent of whether or not the host roams between different networks.
Activate the connection:
# nmcli connection up example-loopback
Verification
Display the settings of the
lo
interface:# ip address show lo 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16384 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet
192.0.2.1/24
brd192.0.2.255
scope global lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft foreverVerify the DNS address:
# cat /etc/resolv.conf ... nameserver
192.0.2.0
...
15.2. Permanently configuring a device as unmanaged in NetworkManager
You can permanently configure devices as unmanaged
based on several criteria, such as the interface name, MAC address, or device type.
To temporarily configure network devices as unmanaged
, see Temporarily configuring a device as unmanaged in NetworkManager.
Procedure
Optional: Display the list of devices to identify the device or MAC address you want to set as
unmanaged
:# ip link show ... 2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000 link/ether 52:54:00:74:79:56 brd ff:ff:ff:ff:ff:ff ...
Create the
/etc/NetworkManager/conf.d/99-unmanaged-devices.conf
file with the following content:To configure a specific interface as unmanaged, add:
[keyfile] unmanaged-devices=interface-name:enp1s0
To configure a device with a specific MAC address as unmanaged, add:
[keyfile] unmanaged-devices=mac:52:54:00:74:79:56
To configure all devices of a specific type as unmanaged, add:
[keyfile] unmanaged-devices=type:ethernet
To set multiple devices as unmanaged, separate the entries in the
unmanaged-devices
parameter with a semicolon, for example:[keyfile] unmanaged-devices=interface-name:enp1s0;interface-name:enp7s0
Reload the
NetworkManager
service:# systemctl reload NetworkManager
Verification
Display the list of devices:
# nmcli device status DEVICE TYPE STATE CONNECTION enp1s0 ethernet unmanaged -- ...
The
unmanaged
state next to theenp1s0
device indicates that NetworkManager does not manage this device.
Troubleshooting
If the device is not shown as
unmanaged
, display the NetworkManager configuration:# NetworkManager --print-config ... [keyfile] unmanaged-devices=interface-name:enp1s0 ...
If the output does not match the settings that you configured, ensure that no configuration file with a higher priority overrides your settings. For details about how NetworkManager merges multiple configuration files, see the
NetworkManager.conf(5)
man page.
15.3. Temporarily configuring a device as unmanaged in NetworkManager
You can temporarily configure devices as unmanaged
.
Use this method, for example, for testing purposes. To permanently configure network devices as unmanaged
, see Permanently configuring a device as unmanaged in NetworkManager.
Procedure
Optional: Display the list of devices to identify the device you want to set as
unmanaged
:# nmcli device status DEVICE TYPE STATE CONNECTION enp1s0 ethernet disconnected -- ...
Set the
enp1s0
device to theunmanaged
state:# nmcli device set enp1s0 managed no
Verification
Display the list of devices:
# nmcli device status DEVICE TYPE STATE CONNECTION enp1s0 ethernet unmanaged -- ...
The
unmanaged
state next to theenp1s0
device indicates that NetworkManager does not manage this device.
Additional resources
-
NetworkManager.conf(5)
man page