0

I am changing/spoofing my MAC using

sudo ifconfig wlan0 down
sudo ifconfig wlan0 hw ether  xx:xx:xx:xx:xx:xx
sudo ifconfig wlan0 up

But the problem is When I try to connect the AP it do not allow me. And then my MAC is automatically changed to my original MAC.

Obviously then I can connect to AP.

What is the reason of the problem. As much as I know the networking it should be allowed. Because After changing MAC. I am connecting like new device.

So what could be solution?

I also tried from GUI, Edit connection

Ubuntu version is 14.04

3

network-manager is interferring with the change of mac address.

You can automate the mac spoofing with an udev rules. It will be applied automatically while booting.

Create a file /etc/udev/rules.d/99-mac-spoofing.rules with the following content

ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="XX:XX:XX:XX:XX:XX", RUN+="/sbin/ip link set dev %k address YY:YY:YY:YY:YY:YY"

where XX:XX:XX:XX:XX:XX is the old mac address and YY:YY:YY:YY:YY:YY the new one.

You can even use random mac address by using macchanger -r in the udev rules.

The wifi AP may have MAC address filtering enabled.

  • I cant copy the file in folder. OS not permitting me to do. And thats my university router and i dont think so they have MAC address filtering enabled – Adnan Ali May 31 '15 at 16:15
0

Considerations are: a) There are problems with network-manager that revert back to the original hardware mac address when restarted b) When stopping then restarting network-manager the GUI for VPN is no longer visible c) Macchanger with switches is not working OR working on startup

So I wrote a script as follows to build a random MAC and assign it to the wlan0

    ##################################################
    #!/bin/bash

    #add chars to the mac
    this+=$(echo "obase=16; $(shuf -i 0-15 -n 1) " | bc ) 
    this+=$(echo "obase=16; $(shuf -i 0-15 -n 1) " | bc )
    this+=":"
    this+=$(echo "obase=16; $(shuf -i 0-15 -n 1) " | bc ) 
    this+=$(echo "obase=16; $(shuf -i 0-15 -n 1) " | bc )
    this+=":"
    this+=$(echo "obase=16; $(shuf -i 0-15 -n 1) " | bc ) 
    this+=$(echo "obase=16; $(shuf -i 0-15 -n 1) " | bc )
    this+=":"
    this+=$(echo "obase=16; $(shuf -i 0-15 -n 1) " | bc ) 
    this+=$(echo "obase=16; $(shuf -i 0-15 -n 1) " | bc )
    this+=":"
    this+=$(echo "obase=16; $(shuf -i 0-15 -n 1) " | bc ) 
    this+=$(echo "obase=16; $(shuf -i 0-15 -n 1) " | bc )
    this+=":"
    this+=$(echo "obase=16; $(shuf -i 0-15 -n 1) " | bc ) 
    this+=$(echo "obase=16; $(shuf -i 0-15 -n 1) " | bc )

    sudo ifconfig wlan0 down

    sudo ifconfig wlan0 hw ether $this

    sudo ifconfig wlan0 up

    ######################################################

In the Network-Manager GUI, de-select "Enable wifi" then select "Enable wifi" You can do an ifconfig to confirm the mac is changed. The network-manager is still visible and working to connect to your VPN.

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.