Re: ethernet connection



On Wed, 2020-02-12 at 22:29 +0100, read shrl nl wrote:
Is there a way to configure two wired connections. One for my home
network (assigned-mac-address=permanent) and one for all other wired
connections (assigned-mac-address=random) in a manner at which
networkmanager autodetects if the wired connection is at my home
network?

Hi,

I think you talk about NetworkManager automatically connecting to a
profile. Currently, NetworkManager honors connection.autoconnect-
priority to select the best candidate profile to autoactivate. In case
there are multiple profiles, it chooses the one that was connected as
last (based on timestamp).

For example, you could imagine to autoconnect profiles based on some
LLDP messages. However, that is not implemented. It also seems
problematic:

  - it seems a bit ugly to let an untrusted network decide which
profile you activate.

  - also, this would only be useful if you have multiple candidate
profiles, at least one restricted to autoconnect only when seeing some
LLDP messages. However, that means, NetworkManager would have to wait
for a time to see whether the LLDP message is present. That doesn't
seem desirable.


But sure. I guess you could imagine useful things to detect the network
and conditionally activate profiles. But that doesn't seem so easy in
general. In practice the "prefer to autoconnect last profile" covers a
lot of sensible use cases.


best,
Thomas


PS1: possibly you should then also tell UDEV to randomize the MAC
address from the start. When NetworkManager activates a profile (and
changes the MAC address), it tends to reset the previous MAC address on
deactivation. I think, NM should never reset it to the permanent
address (while the device is unused).

PS2: Unrelated: maybe you'd prefer "stable" instead of "permanent". In
fact, I'd use ([1]) and then on your home network only set

  nmcli connection modify "$HOME" connection.stable-id "${CONNECTION}"

[1] 
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/blob/904050dd2dc09826e8ae59fd19eae95e8e7adcb7/examples/nm-conf.d/30-anon.conf

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]