Instantly share code, notes, and snippets.

Embed
What would you like to do?
MAC address randomization in Ubuntu 17+ (>= 1.4.1): save to /etc/NetworkManager/conf.d/
# /etc/NetworkManager/conf.d/30-randomize-mac-address.conf
# REQUIRES NETWORK MANAGER >= 1.4.1 (Ubuntu Zesty and above)
# Thanks to https://blogs.gnome.org/thaller/2016/08/26/mac-address-spoofing-in-networkmanager-1-4-0/
# This randomize your MAC address for *new* connections
# Be sure to change your existing (saved) connections in
# /etc/NetworkManager/system-connections/*
# NOTE: To support captive-portals that rely on a consistent mac address,
# use `cloned-mac-address=stable` in /etc/NetworkManager/system-connections/[network name]
[device-mac-randomization]
# "yes" is already the default for scanning
wifi.scan-rand-mac-address=yes
[connection-mac-randomization]
ethernet.cloned-mac-address=stable
wifi.cloned-mac-address=random
# The options are:
#
# - permanent: use the hardware MAC
# - preserve: don’t change the MAC address of the device upon activation.
# - random: generate a randomized value upon each connect.
# - stable: generate a stable, hashed MAC address.
#
@armsp

This comment has been minimized.

armsp commented Dec 9, 2018

Hi Paul, coming here from your blog. I didn't quite understand how to do this part -

Be sure to change your existing (saved) connections in
/etc/NetworkManager/system-connections/*

So i followed your post and the suggestion from gnome's blog too, i.e made changes to the file in /usr/lib/NetworkManager/conf.d instead of directly editing the file in /etc/NetworkManager/conf.d. So far I haven't seen any changes in my mac address (same network) even after rebooting/ restarting network manager. Asked for help here by giving more details. Nothing so far.
Could you please elucidate how to do the quoted part above?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment