How to activate MAC anonymization on Linux?

Configuring NetworkManager. Add a configuration file under /etc/NetworkManager/conf.d with the following content

[device]
wifi.scan-rand-mac-address=yes

[connection]
connection.stable-id=${CONNECTION}/${BOOT}
ethernet.cloned-mac-address=stable
wifi.cloned-mac-address=stable
Possible values for *.cloned-mac-address
  • stable to create a consistent hashed MAC for every activation of a NetworkManager connection, but use a unique MAC for each connection
  • random to obtain a completely random MAC for each activation

Then restart the service: systemctl restart NetworkManager