Can't change my mac address - can't assign requested address

Solution 1:

03:a0:04:d3:00:11 is not an unicast address as the first octet needs to be even. Look at the image below to understand it better. This image is from Wikipedia - MAC address page

so put instead 02:a0:04:d3:00:11 for example

enter image description here

Solution 2:

try this out c what happens actually there is a particular pattern of mac address which is only registered one so with a random mac address you can't change the address.

ifconfig | grep HWaddr
ifconfig eth0 down
ifconfig eth0 hw ether 00:1E:68:35:FF:91
ifconfig eth0 up
ifconfig eth0 hw ether 00:1d:92:43:f1:29

Best of luck

Solution 3:

I assume that because you are trying to change the HWaddr of your wireless interface, that you are attempting some wireless pentesting and need to spoof your HWaddr. Well there are a few ways to do this but I will give you my method since I have not seen it included here. The following bash shell code is a very basic random HWaddr generator that I created. It isn't perfect and does have some bugs (such as certain generated MACs not being allowed to the device).

Here is the random HWaddr function for bash:

#!/bin/bash

RAND_MAC() {

gen() {
NUM="$(tr -dc '0-9a-f' </dev/urandom | head -c 2)"
echo -n "$NUM:"
}

for c in {1..6}; do

   if [ "$c" -lt "6" ]; then
      gen
   else
      gen | tr -d ':'
   fi

done
}

RAND_MAC

Now I will explain what is going on with this function:

RAND_MAC() is going to be the function declaration. This is pretty much letting the bash shell interpreter know "Hey, there is a function here." and for it to look for open and close braces {}. After the RAND_MAC() function is declared, there is a single { followed by a nested new function declaration called gen(). Nested pretty much just means a function inside a function. The gen() function is what will randomly generate the octets of the random HWaddr. gen() is a self-contained function and only activates during the for loop below it executes. When gen() is called, a variable called NUM is assigned the value of a command's output. The command which NUM is being assigned is $(tr -dc '0-9a-f' </dev/urandom | head -c 2). This will output a 2-character string using numbers 0-9 and lower case lettersa-fin random order by pulling from/dev/urandom`.

So now that the function gen() is pretty much explained, the rest of the main function RAND_MAC() is going to control the show. The forloop will iterate 6 times. After the 6th iteration, the forloop moves to done and it is finished. The result is a freshly generated HWaddr you can now use with your wlan0 interface or whatever your interface is named. The reason we are using bash functions for this is to keep the data of this script from being in a global scope. We want to keep such scripts local to eliminate errors that I won't get into here. Once you have the function saved to a file, such as something like /usr/bin/macgen, give it permission to be executed.

user@group:~# chmod +x /usr/bin/macgen

Now your new HWaddr-generating script is ready to use whenever you want from the terminal command line. You can call the tool by using the command, macgen.

Now comes how to assign this new HWaddr using the method that hasn't been given.

Many have suggested using ifconfig or maybe even iwconfig for changing your wireless interface's HWaddr. Well, ifconfig and even iwconfig are depreciated tools and have pretty much been superseded by the tools called ip and iw. The tool I will use in this answer is iw. The following commands will be what you need to follow to create a virtual interface, spoof it's HWaddr, and prevent having to change your real physical hardware's HWaddr. This method, to me, is much more sane and safer since we can simply bring our real physical interface down with ifconfig and use a completely virtual and fake interface to do all that we want:

First, we will generate the new HWaddr to use.

user@group:~# macgen

Then we will use ifconfig to bring the real device down.

user@group:~# ifconfig wlan0 down

Now we can create the VNIC with iw.

user@group:~# iw dev wlan0 interface add mon0 type monitor addr (new mac here)

And finally, we bring the interface up.

user@group:~# ifconfig mon0 up

Now you should have a spoofed wireless interface in monitor mode as well as a spoofed mac address for that interface. If you need to change it's mode from monitor to managed so that you can use it to connect to an access point just do the following:

Bring the VNIC down:

user@group:~# ifconfig mon0 down

Change the mode:

user@group:~# iwconfig mon0 mode managed

[Quick note] Before changing the mode, make sure all other managed mode interfaces are down otherwise, you will toggle an error flag with iwconfig.

Bring interface back up:

user@group:~# ifconfig mon0 up

Check to make sure the configurations are correct with:

user@group:~# iw dev

The output should look similar to this:

phy#0
      Interface wlo1
           ifindex 3
           wdev 0x1
           addr 00:11:22:33:44:55
           type managed
           channel 161 (5805 MHz), width: 40 MHz, center1: 5795 MHz
           txpower 50.00 dBm

And when you are ready to get rid of the VNIC, just delete it:

user@group:~# iw mon0 del

And then bring your real interface back up:

user@group:~# ifconfig wlan0 up

Hope this information helps. Feel free to ask if you are confused about any of this.