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

Discussion in 'Wireless Internet' started by Silent Knight, Jun 21, 2014.

  1. 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?
     
    Silent Knight, Jun 21, 2014
    #1
    1. Advertisements

  2. Silent Knight

    Shadow Guest

    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
     
    Shadow, Jun 21, 2014
    #2
    1. Advertisements

  3. 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

    $ 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?
     
    Silent Knight, Jun 21, 2014
    #3
  4. 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

    $ 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?
     
    Silent Knight, Jun 21, 2014
    #4
  5. Silent Knight

    Shadow Guest

    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
     
    Shadow, Jun 21, 2014
    #5
  6. Silent Knight

    Shadow Guest

    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
     
    Shadow, Jun 21, 2014
    #6
  7. Darn! Too damned long for a nym!
     
    DecadentLinuxUserNumeroUno, Jun 21, 2014
    #7
  8. Silent Knight

    John Hasler Guest

    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.
     
    John Hasler, Jun 24, 2014
    #8
  9. 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
     
    William Unruh, Jun 27, 2014
    #9
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.