NetworkManager duplicates a connection after restart of NetworkManager service.
Environment
- Red Hat Enterprise Linux 7
- Red Hat Enterprise Linux 8
Issue
- Performing a change in ifcfg files and restarting NetworkManager results in duplicate connection.
Resolution
- Do not restart NetworkManager when the configuration on the device differs from the configuration of the profile on disk. In order to apply the changes you need to reactivate the connection as the changes do not automatically apply on the device.
This can be achieved by either
$ nmcli connection up $PROFILE
Or
$ nmcli device reapply $DEV
Root Cause
- This is an expected behaviour.
- When NetworkManager is restarted, devices are left up. After the restart, NetworkManager tries to take over previously configured devices, however, if the connection on disk does not match the configuration on the device, NetworkManager will leave the existing device configuration and create an in-memory connection that reflects what is configured on the device.
Diagnostic Steps
$ nmcli connection show
NAME UUID TYPE DEVICE
bond-slave-eth1 fae338aa-9d39-476a-b838-03f2db87f877 802-3-ethernet eth1
bond-slave-eth2 26815d39-f7a6-4921-9135-6376c8cceece 802-3-ethernet eth2
bond0 3c170ef9-32f2-4bde-9c56-d7ff2017f8a4 bond bond0
eth0 ce21b538-7c07-45f6-b00f-2eed0f731b67 802-3-ethernet eth0
virbr0 20a4ebb0-a91b-4fb9-9040-27c8e528ad50 bridge virbr0
$ vi /etc/sysconfig/network-scripts/ifcfg-eth0
$ systemctl restart NetworkManager
$ nmcli connection show
NAME UUID TYPE DEVICE
bond-slave-eth1 fae338aa-9d39-476a-b838-03f2db87f877 802-3-ethernet eth1
bond-slave-eth2 26815d39-f7a6-4921-9135-6376c8cceece 802-3-ethernet eth2
bond0 3c170ef9-32f2-4bde-9c56-d7ff2017f8a4 bond bond0
eth0 494ee46d-6882-49cf-b661-79b81cf3a760 802-3-ethernet eth0
virbr0 c5a8817d-cda7-4ce2-a901-679a82542376 bridge virbr0
eth0 ce21b538-7c07-45f6-b00f-2eed0f731b67 802-3-ethernet --
$ vi /etc/sysconfig/network-scripts/ifcfg-eth0
$ nmcli device reapply eth0
Connection successfully reapplied to device 'eth0'.
$ nmcli connection show
NAME UUID TYPE DEVICE
bond-slave-eth1 fae338aa-9d39-476a-b838-03f2db87f877 802-3-ethernet eth1
bond-slave-eth2 26815d39-f7a6-4921-9135-6376c8cceece 802-3-ethernet eth2
bond0 3c170ef9-32f2-4bde-9c56-d7ff2017f8a4 bond bond0
eth0 ce21b538-7c07-45f6-b00f-2eed0f731b67 802-3-ethernet eth0
virbr0 c5a8817d-cda7-4ce2-a901-679a82542376 bridge virbr0
SBR
Product(s)
Components
Category
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.