Is it possible to randomise the mac address with systemd itself? I have heard that it is possible in newer versions of systemd. This is my systemd version:

systemd --version
systemd 229

But the link files just are not there.


You can set MACAddressPolicy to random in your network device configuration file aka the systemd.link file e.g. /etc/systemd/network/40-wlan-mac.link:



If you have no custom .link files, the default MACAddressPolicy is specified in the upstream .link file in /usr/lib/systemd/network/99-default.link and it applies to all devices.

  • I don't seem to have any of those files. So I guess that that subsystem of systemd is not implemented in my distro.(Ubuntu 16.04) – Mario Kamenjak Jun 2 '16 at 14:09
  • I edited the question. – Mario Kamenjak Jun 3 '16 at 9:49
  • @MarioKamenjak - well, I don't use Ubuntu (and I'll never use it) so I can't help you there. You could just create /usr/lib/systemd/network/99-default.link yourself and see if it works, by default it has three lines: [Link] then NamePolicy=kernel database onboard slot path then MACAddressPolicy=persistent – don_crissti Jun 3 '16 at 10:33
  • OK I will try it later. Thank you anyways! – Mario Kamenjak Jun 4 '16 at 11:13
  • How can one apply the modification on the fly? Is there something I need to restart, possibly not the whole machine? The manpage mentions something called net_setup_link, but apparently nothing else has got this name. – Dacav Jun 8 '16 at 17:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.