How to make the wlan0 NIC MAC address change stick after reboot?

I'm pretty sure the 'router' at a public hotspot knows your MAC address, and probably your laptop hostname (and maybe even your username?).

It's easy to change the hostname & MAC address, but is there a way to make the MAC address change survive a reboot?

My hostname change on Ubuntu 13.10 survives a reboot: $ sudo hostname newhostname $ sudo vi /etc/hostname $ sudo vi /etc/hosts $ hostname

But, the way I change the MAC doesn't seem to survive the reboot: $ sudo ifconfig wlan0 down $ sudo ifconfig wlan0 hw ether DE:AD:BE:EF:CA:FE $ sudo ifconfig wlan0 up $ ifconfig -a | grep HWaddr

Is there an easy way to make an Ubuntu MAC change stick after reboot?

Reply to
Silent Knight
Loading thread data ...

Sure, install macchanger. Use it in your /etc/{ whatever} rc.local script You can even make it randomize numbers, manufacturers etc. Macchanger was made for it. PS: disable IPV6..... use only IPV4. Not sure IPV6 if queries the hardware or the number you change your MAC to.

Another PS :You might want to look into the aircrack-ng tools, they can set your adaptor to promiscuous mode at startup too. It will appear as mon0. (again, in the rc.local script) []'s

Reply to
Shadow

Shadow wrote, on Sat, 21 Jun 2014 13:57:21 -0300:

Interesting this 'macchanger' program. It may be useful, but, a first pass shows it's more work to use manually than to just issue the manual ifconfig commands.

However, I guess the value of macchanger is the "-r" randomizer. Is that correct?

$ macchanger The program 'macchanger' is currently not installed. You can install it by typing: sudo apt-get install macchanger

$ sudo apt-get install macchanger

$ which macchanger /usr/bin/macchanger

$ macchanger --help GNU MAC Changer Usage: macchanger [options] device

-h, --help Print this help -V, --version Print version and exit -s, --show Print the MAC address and exit -e, --ending Don't change the vendor bytes -a, --another Set random vendor MAC of the same kind -A Set random vendor MAC of any kind -p, --permanent Reset to original, permanent hardware MAC -r, --random Set fully random MAC -l, --list[=keyword] Print known vendors -m, --mac=XX:XX:XX:XX:XX:XX --mac XX:XX:XX:XX:XX:XX Set the MAC XX:XX:XX:XX:XX:XX

Report bugs to snipped-for-privacy@gnu.org

$ sudo macchanger -r wlan0 Permanent MAC: 00:a8:c3:af:33:b9 (Intel Corporate) Current MAC: de:ad:be:ef:ca:fe (unknown) ERROR: Can't change MAC: interface up or not permission: Device or resource busy

$ sudo ifconfig wlan0 down $ sudo macchanger -r wlan0 Permanent MAC: 00:a8:c3:af:33:b9 (Intel Corporate) Current MAC: de:ad:be:ef:ca:fe (unknown) New MAC: 54:c4:a5:de:32:63 (unknown)

$ sudo ifconfig wlan0 up $ ifconfig -a | grep HWaddr eth0 Link encap:Ethernet HWaddr ca:fe:de:ad:be:ef wlan0 Link encap:Ethernet HWaddr 54:c4:a5:de:32:63

It seems the use model is three commands, in sequence:

  1. sudo ifconfig wlan0 down
  2. macchanger -r wlan0
  3. sudo ifconfig wlan0 up

Is that what you suggest I put in rc.local on Ubuntu saucy?

Reply to
Silent Knight

Shadow wrote, on Sat, 21 Jun 2014 13:57:21 -0300:

Interesting this 'macchanger' program. It may be useful, but, a first pass shows it's more work to use manually than to just issue the manual ifconfig commands.

However, I guess the value of macchanger is the "-r" randomizer. Is that correct?

$ macchanger The program 'macchanger' is currently not installed. You can install it by typing: sudo apt-get install macchanger

$ sudo apt-get install macchanger

$ which macchanger /usr/bin/macchanger

$ macchanger --help GNU MAC Changer Usage: macchanger [options] device

-h, --help Print this help -V, --version Print version and exit -s, --show Print the MAC address and exit -e, --ending Don't change the vendor bytes -a, --another Set random vendor MAC of the same kind -A Set random vendor MAC of any kind -p, --permanent Reset to original, permanent hardware MAC -r, --random Set fully random MAC -l, --list[=keyword] Print known vendors -m, --mac=XX:XX:XX:XX:XX:XX --mac XX:XX:XX:XX:XX:XX Set the MAC XX:XX:XX:XX:XX:XX

Report bugs to snipped-for-privacy@gnu.org

$ sudo macchanger -r wlan0 Permanent MAC: 00:a8:c3:af:33:b9 (Intel Corporate) Current MAC: de:ad:be:ef:ca:fe (unknown) ERROR: Can't change MAC: interface up or not permission: Device or resource busy

$ sudo ifconfig wlan0 down $ sudo macchanger -r wlan0 Permanent MAC: 00:a8:c3:af:33:b9 (Intel Corporate) Current MAC: de:ad:be:ef:ca:fe (unknown) New MAC: 54:c4:a5:de:32:63 (unknown)

$ sudo ifconfig wlan0 up $ ifconfig -a | grep HWaddr eth0 Link encap:Ethernet HWaddr ca:fe:de:ad:be:ef wlan0 Link encap:Ethernet HWaddr 54:c4:a5:de:32:63

It seems the use model is three commands, in sequence:

  1. sudo ifconfig wlan0 down
  2. macchanger -r wlan0
  3. sudo ifconfig wlan0 up

Is that what you suggest I put in rc.local on Ubuntu saucy?

Reply to
Silent Knight

Yes. I'm not on Ubuntu., ATM. In rc.local, it's good form to put the full path to the executable. Do a which macchanger which ifconfig

And use

/usr/sbin/macchanger blablabla /usr/sbin/ifconfig blablabla

(or whatever "which" tells you) And I believe rc.local is run as root. No need for the sudo. If rc.local is absent, when you create it, don't forget to make it executable. HTH []'s

Reply to
Shadow

Yes, but you don't want an nonexistent manufacturer. The -A is more "low profile" To be "silent" you have to blend in, not stand out like a single currant in a bowl of custard. ;) []'s

Reply to
Shadow

On Sat, 21 Jun 2014 15:11:16 -0300, Shadow Gave us:

Darn! Too damned long for a nym!

Reply to
DecadentLinuxUserNumeroUno

Ubuntu doesn't use rc.local

Reply to
Daniel Webster

Yes, but it can. By default the execute bit is set but it only contains one command: exit 0, which does nothing but it does get executed. Any commands added will also be executed.

Here is the contents from Ubuntu 12.04LTS...

----------------- #!/bin/sh -e # # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will "exit 0" on success or any other # value on error. # # In order to enable or disable this script just change the execution # bits. # # By default this script does nothing.

exit 0

-----------------

Reply to
Wildman

Shadow wrote, on Tue, 24 Jun 2014 09:54:15 -0300:

Huh?

I know that, normally, the router access point knows your MAC address, but that's it. The MAC address doesn't get past the router.

So, say, if you're at Starbucks, the Starbucks router knows your MAC address, but the upstream (say AT&T) router does not.

Are you saying that this is no longer the case?

Reply to
Silent Knight

He is saying that your software may use your MAC address to form an interface identifier. Whether or not it does so is, of course, under your control.

Reply to
John Hasler

John Hasler wrote, on Tue, 24 Jun 2014 14:01:41 -0500:

Oh, OK. Well, all the more reason to change the MAC address then.

Reply to
Silent Knight

I would put this in /etc/network/interfaces, as this is just the job for a pre-up command, however, you don't mention what you're using to manage the network settings on that machine so it may not play well.

Reply to
alexd

alexd wrote, on Wed, 25 Jun 2014 17:41:48 +0100:

I'm using stock Ubuntu 13.10, so, I don't even know what it's using to manage the network. I think it's called Gnome, but, it's whatever is default.

On the top right of the screen, I have a bar of icons, one of which is the wireless icon, which, when I pull it down, is titled "Network Connections".

If I look in /etc/network/, I have $ file /etc/network/* /etc/network/if-down.d: directory /etc/network/if-post-down.d: directory /etc/network/if-pre-up.d: directory /etc/network/if-up.d: directory /etc/network/interfaces: ASCII text /etc/network/interfaces.d: directory /etc/network/run: symbolic link to `/run/network'

$ cat /etc/network/interfaces # interfaces(5) file used by ifup(8) and ifdown(8) auto lo iface lo inet loopback

$ ps -elfww|grep network

4 S root 10279 889 0 80 0 - 2561 poll_s 10:06 ? 00:00:00 /sbin/dhclient -d -sf /usr/lib/NetworkManager/nm-dhcp-client.action -pf /run/sendsigs.omit.d/network-manager.dhclient-wlan0.pid -lf /var/lib/NetworkManager/dhclient-35401391-727b-407f-94fb-6c21d6c27929-wlan0.lease -cf /var/lib/NetworkManager/dhclient-wlan0.conf wlan0

Given that, where would you suggest I put the macchanger command?

Reply to
Silent Knight

Gnome is the windows manager ( the thing that puts the icons etc onto your screen) and has noting to do with networks. Your network manager might quite probably be NetworkManager.

This is the directory he was refering to. I do not run ubuntu but it probably has a number of files in it. He is suggesting you put a file in there to make it run the command to set you mac address

Reply to
William Unruh

This is the one. Each interface definition can have any number of pre-up and post-up commands. On my Debian server I use a pre-up command to build a bridge interface out of a bunch of ethernet NICs, before applying the IP settings.

I use Ubuntu on my laptop with WICD for network management. I think I binned NM because it was sucking in one way or another, and now 4 years later WICD has all the wireless networks remembered for all the places I go so I've no great reason to go back to NM. I don't think /etc/network/interfaces would play well with this. Closer inspection reveals that WICD also has a pre-up, post-up, pre-down and post-down option just like /e/n/i so that's how I'd approach it on my system.

From that ps output you look to be running Network Manager. This page suggests that the two could be made to co-operate:

formatting link

but I'm not sure if you be able to get ifupdown to set the MAC and NM to handle the WLAN parameters at the same time...I guess it depends how sticky the MAC address setting is? Perhaps NetworkManager has its own equivalent of pre-up?

Reply to
alexd

Cabling-Design.com Forums website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.