I wonder, why can't I change my mac address by doing this:

sudo ifconfig wlan0 down
sudo ifconfig wlan0 hw ether 03:a0:04:d3:00:11

The error is SIOCSIFHWADDR: Cannot assign requested address I googled but found nothing valuable.

P.S As usual, I can't do this. Nothing works. I took the new mac address which was incremented by 1 from my current one (old 11:11:11:11:11:cf, new 11:11:11:11:11:d0)

sudo ifconfig wlan0 down
sudo ifconfig wlan0 hw ether 11:11:11:11:11:d0

There was no error, it even connected to wifi automatically after I did this (even though I didn't do sudo ifconfig wlan0 up). I though it won. However, when I did

sudo ip addr

I've seen the same mac address as it had before. Nothing was changed.

  • You want change mac of your wlan0 or eth0? May be problem is that you are downing wlan0, and then change eth0's mac address. Or it is just typo?
    – c0rp
    Feb 20, 2014 at 8:21
  • Have you tried macchanger?
    – g_p
    Feb 20, 2014 at 8:45
  • @c0rp, that was a typo.
    – Incerteza
    Feb 20, 2014 at 10:16
  • Did you try use functionality called Mac Clone in network manager? Link
    – c0rp
    Feb 20, 2014 at 10:57

5 Answers 5


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

  • 2
    I vote to hang the person who made the error message for odd-numbered first-octets so vague. Somebody please mark this answer as the correct answer. Also, this is valid for current distros as well, so the 13.04 tag is too specific.
    – Tim G
    Jul 4, 2017 at 0:25

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

  • shouldn't I use wlan0 instead?
    – Incerteza
    Feb 20, 2014 at 10:16
  • I want to change mac address for wifi. I can't do this when I use wlan0.
    – Incerteza
    Feb 20, 2014 at 10:46
  • Claiming one cannot change to just any random mac is disingenuous. Using my method, which I posted an answer of, one can assign almost any randomly generated mac address to a virtual interface and use it the same as any real interface.
    – Yokai
    Jul 3, 2017 at 11:07

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:



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 | tr -d ':'



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:

      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.

  • fyi - that assumption is unwarranted. there are legitimate reasons for temporarily changing your ip address.
    – dldnh
    Mar 6, 2022 at 21:31

As you know only macchanger is a tool to change mac address in Linux. For changing wlan0 interface type ifconfig wlan0 down macchanger -r wlan0 ifconfig wlan0 up -r for random change (automatic) You can get here a deatail list from Here

  • 1
    Instead of posting a link only please transcribe the answer here in detail. Thanks
    – Wild Man
    Jun 11, 2016 at 3:39
  • @Harinder you just contradicted yourself, macchanger is not the only tool ifconfig interface hw ether XX:XX:XX:XX:XX:XX or even a low level tool like ip link set dev interface address XX:XX:XX:XX:XX:XX can change the mac address, non-permanently.
    – user257256
    Jun 11, 2016 at 3:58



it says the fist number should be a even number it worked for me

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .