5

With Ubuntu 14.04 when I wanted to connect to a network using a different mac address I would run the following commands

sudo service network-manager stop
sudo ifconfig $interface down
sudo macchanger -m <mac_addresse> $interface
sudo ifconfig $interface up
sudo service network-manager start

This would assign a new mac address which persisted after network-manager was restarted and a new connection to the network was made.
now, on Ubuntu 16.04, after running those same commands using

  • sudo macchanger -m 00:60:1B:EB:F8:73 wlp2s0

I then restart network-manager but not connected to the network yet, the new macchanger assigned mac address persists i.e.

% nmcli dev show wlp2s0
GENERAL.DEVICE:                         wlp2s0
GENERAL.TYPE:                           wifi
GENERAL.HWADDR:                         00:60:1B:EB:F8:73
      address assigned by macchanger -->^^^^^^^^^^^^^^^^^
GENERAL.MTU:                            0
GENERAL.STATE:                          30 (disconnected)
GENERAL.CONNECTION:                     --
GENERAL.CON-PATH:                       --

but the moment I connect to a network, the mac address is reset back to the original hardware mac address. after making connection to the network

% nmcli  dev show wlp2s0
GENERAL.DEVICE:                         wlp2s0
GENERAL.TYPE:                           wifi
GENERAL.HWADDR:                         E0:06:E6:A3:2C:A7
   mac is back to original hardware  -->^^^^^^^^^^^^^^^^^

GENERAL.MTU:                            1500
GENERAL.STATE:                          100 (connected)
GENERAL.CONNECTION:                     lowfi
GENERAL.CON-PATH:                       /org/freedesktop/NetworkManager/ActiveConnection/0
IP4.ADDRESS[1]:                         92.10.26.193/20
IP4.GATEWAY:                            92.10.24.1
IP4.ROUTE[1]:                           dst = 169.254.0.0/16, nh = 0.0.0.0, mt = 1000
IP4.DNS[1]:                             202.8.44.226
IP4.DNS[2]:                             202.8.47.10
IP6.GATEWAY:

How can I make the macchanger assigned mac address persist when connecting to the network using the command line?

4

You could use nmcli to temporarily change your mac address:

nmcli connection modify --temporary <connection_name> 802-11-wireless.cloned-mac-address 00:60:1B:EB:F8:73
nmcli connection up <connection_name>

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.