Randomize your MAC address in Ubuntu

Windows 10 users would have probably seen the option on there Wifi settings to enable a random hardware address for networks.

This is useful when wanting to keep anonymous on public wifi connections or even to get more data from connections that have set data limits for a connection.

For Ubuntu this is also possible but unfortunately the setup is a little more complicated than a one click button, but here is one way of enabling it.

  1. Ctrl + Alt + T to start Terminal
  2. Change to the /etc/NetworkManager/conf.d

cd /etc/NetworkManager/conf.d

3. create a conf file called 00-macrandomize.conf

sudo touch 00-macrandomize.conf 

4. Edit the file

sudo nano 00-macrandomize.conf

5. Copy this config in to the file and save it

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

[connection]
wifi.cloned-mac-address=random
ethernet.cloned-mac-address=random
connection.stable-id=${CONNECTION}/${BOOT}

6. Now restart the NetworkManager

 systemctl restart NetworkManager 

Now when you check the MAC address you should see the new random address.

You May Also Like

About the Author: Phil

3 Comments

  1. does not work for me no wifi connection possible when doing this.

    [connection]
    wifi.cloned-mac-address=random
    ethernet.cloned-mac-address=random
    connection.stable-id=${CONNECTION}/${BOOT}

    is there anything you need to enter for ID? or is there a way you can define your alternate MAC Address with your configuration file?

    wifi.cloned-mac-address=[10:33:45:A3:B5:CC, 12:34:34:AB:44:CD]

    for example

  2. for Ubuntu you don’t need to create a .conf file. you should check first if one already exists, revise steps to:
    1. cd /etc/NetworkManager
    2. ls
    if “NetworkManager.conf” shows just open and edit it
    3. sudo nano NetworkManager.conf
    4. it should already have the line
    “[device]
    wifi.scan-rand-mac-address=no”
    if not add that line or change =no to “yes”
    5. add [connection] information above

    By the way this is a warning or note, when trying to do the randomized hardware address for the wifi adapter at least on my MacBook pro 2011 (proprietary driver), it will not work and will not allow you to connect to the internet with a randomized wifi adapter hardware address (for whatever reason).

Leave a Reply to Xeones Cancel reply

Your email address will not be published. Required fields are marked *