When a user wants to configure a device outside of NetworkManager (iproute2), then the best way is to explicitly configure the device as unmanaged in NetworkManager. This can be done via permanent configuration (NetworkManager.conf, udev, etc) or ad-hoc via `nmcli device set "$DEVICE" managed no`.
Of course, often the user doesn't do that. So, when NM notices that the device is externally configured, then it generates an in-memory profile and goes into pretend-only mode. See https://bugzilla.redhat.com/show_bug.cgi?id=1616363#c3
This "externally-managed" behaviour is complex, confusing and buggy.
Another problem is, when the user does not intend NM to handle the device, NM still touches and interferes. It does so when moving the devices into "disconnected" state. At the very least NM will:
- set the device as IFF_UP (it does so, because NM wants to receive the state of carrier/cable)
- it will set IPv6 addr-gen-mode none and accept_ra 0 (because while IFF_UP, the device must be logically disconnected and have no IP configuration. See also bug 1628900).
If the user then wants to configure the device manually, NM already disables IPv6 on the device and otherwise interfered.
This is ultimately because
- NetworkManager wants to manage devices by default. It assumes that if you run NM, then you want to use it. Also, it currently really wants to get the carrier state and set the device IFF_UP (and interfering with it already).
- by default (unless "main.no-auto-default" is on), NM will even go so far and generate a default profile that can autoactivate on the device. It really wants to manage this device.
I think we could improve this easily. Add a new option "device.no-auto-manage". This option is per-device (or of course, for every device).
"device.no-auto-manage=1" means, that NM will automatically mark the device as unmanaged until a connection profile for the device exits.
"device.no-auto-manage" implies "main.no-auto-default".
This is more like what systemd-networkd does: the device is unmanaged by default, unless there is a profile for it.
A package like NetworkManager-config-server could install such a configuration snippet. For example /usr/lib/NetworkManager/conf.d/00-server.conf with
[device-00-server-no-auto-managed]
# only do this for certain device types:
match-device=type:ethernet,type:bond,type:bridge
no-auto-managed=1
an expicit `nmcli device connect` shold still overrule this (including generating a profile, as it currently would).
Thank you for reporting this. Unfortunately, we don't have the capacity to fix this in the foreseeable future and therefore I will close this. In case this issue is more important than we estimated, please re-open this or file a new bug.