How do I randomize the MAC address 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

Sources and review

Last reviewed: . Technical claims on this page follow the primary sources below; operating-system interfaces change between releases, so check them against your own device version.