Cloned mac address for wired connection

I am trying to set up cloned mac address as stable for wired connection. The sys-net is an AppVM based on a template built using debian-12-minimal.

The bind-dirs is set up correctly and the file /etc/NetworkManager/conf.d/mac-random.conf is updated as below in the sys-net AppVM

[connection-mac-randomization]
ethernet.cloned-mac-address=stable

The below line in journalctl confirms that the config is picked up.

Jan 18 03:45:54 sys-net NetworkManager[<pid>]: <info>  [1705545954.0592] device (<eth>): set-hw-addr: set-cloned MAC address to <mac-address> (stable)

But the problem is that mac address is not consistent across reboots. My understanding is that the stable option should provide same mac address across reboots.

There is one more issue described below. However not sure if its related to the issue described above. There is no entry for the wired connection in /etc/NetworkManager/system-connections/. So, I open the Edit Connections dialog, updated some details in the wired connection, click save and did not see any entry made in the system connections folder. The below line in the journalctl indicates why there is no entry in the system connections folder

Jan 18 01:24:46 sys-net NetworkManager[<pid>]: <info>  [1705537486.0702] audit: op="connection-update" uuid="<uuid>" name="Wired connection 1" pid=<pid> uid=1000 result="fail" reason="Insufficient privileges"

Any inputs on how can I get consistent MAC address across reboots?

Bump!

Anyone knows how the stable option presents same mac address accorss reboots? Does it store in local disk that I need to include in bind-dirs?

The stable address is generated by hashing a private key from /var/lib/NetworkManager/secret_key, the ifname of the device, and a stable-id. The stable-id by default is the UUID of the connection (“connection.uuid”), unless you configure the new property “connection.stable-id“. The latter allows you to have multiple connections that generate the same MAC address. Note that “connection.stable-id” property is also used when generating stable-privacy IPv6 addresses (“ipv6.addr-gen-mode”, RFC 7217).

https://blogs.gnome.org/thaller/2016/08/26/mac-address-spoofing-in-networkmanager-1-4-0/

Run nm-connection-editor from root terminal.

1 Like

I was looking for info on why the NetworkManager service does not work out of the box. Running nm-connection-editor from root terminal does not fix the OG issue of mac-cloned-address=stable not working. I think it’ll work if the NetworkManager service able to store the information. I see it happening in a debian loptop and not in debian-12-minimal qube.

Add /var/lib/NetworkManager/secret_key and /usr/lib/NetworkManager/conf.d/31-randomize-mac.conf to bind_dirs and then change in /usr/lib/NetworkManager/conf.d/31-randomize-mac.conf:

connection.stable-id=${CONNECTION}/${BOOT}

to

connection.stable-id=${CONNECTION}