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





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







4















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.










share|improve this question

























  • 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 '14 at 8:21













  • Have you tried macchanger?

    – g_p
    Feb 20 '14 at 8:45











  • @c0rp, that was a typo.

    – アレックス
    Feb 20 '14 at 10:16











  • Did you try use functionality called Mac Clone in network manager? Link

    – c0rp
    Feb 20 '14 at 10:57




















4















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.










share|improve this question

























  • 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 '14 at 8:21













  • Have you tried macchanger?

    – g_p
    Feb 20 '14 at 8:45











  • @c0rp, that was a typo.

    – アレックス
    Feb 20 '14 at 10:16











  • Did you try use functionality called Mac Clone in network manager? Link

    – c0rp
    Feb 20 '14 at 10:57
















4












4








4








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.










share|improve this question
















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.







ifconfig






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited May 3 '18 at 18:00









Kiwy

225215




225215










asked Feb 20 '14 at 8:00









アレックスアレックス

71541124




71541124













  • 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 '14 at 8:21













  • Have you tried macchanger?

    – g_p
    Feb 20 '14 at 8:45











  • @c0rp, that was a typo.

    – アレックス
    Feb 20 '14 at 10:16











  • Did you try use functionality called Mac Clone in network manager? Link

    – c0rp
    Feb 20 '14 at 10:57





















  • 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 '14 at 8:21













  • Have you tried macchanger?

    – g_p
    Feb 20 '14 at 8:45











  • @c0rp, that was a typo.

    – アレックス
    Feb 20 '14 at 10:16











  • Did you try use functionality called Mac Clone in network manager? Link

    – c0rp
    Feb 20 '14 at 10:57



















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 '14 at 8:21







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 '14 at 8:21















Have you tried macchanger?

– g_p
Feb 20 '14 at 8:45





Have you tried macchanger?

– g_p
Feb 20 '14 at 8:45













@c0rp, that was a typo.

– アレックス
Feb 20 '14 at 10:16





@c0rp, that was a typo.

– アレックス
Feb 20 '14 at 10:16













Did you try use functionality called Mac Clone in network manager? Link

– c0rp
Feb 20 '14 at 10:57







Did you try use functionality called Mac Clone in network manager? Link

– c0rp
Feb 20 '14 at 10:57












5 Answers
5






active

oldest

votes


















8














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






share|improve this answer





















  • 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 '17 at 0:25





















1














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






share|improve this answer


























  • shouldn't I use wlan0 instead?

    – アレックス
    Feb 20 '14 at 10:16











  • I want to change mac address for wifi. I can't do this when I use wlan0.

    – アレックス
    Feb 20 '14 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 '17 at 11:07



















1














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.






share|improve this answer

































    0














    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






    share|improve this answer



















    • 1





      Instead of posting a link only please transcribe the answer here in detail. Thanks

      – Wild Man
      Jun 11 '16 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 '16 at 3:58



















    0














    http://www.microhowto.info/howto/change_the_mac_address_of_an_ethernet_interface.html



    SEE THIS



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






    share|improve this answer
























      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "89"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f423530%2fcant-change-my-mac-address-cant-assign-requested-address%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      5 Answers
      5






      active

      oldest

      votes








      5 Answers
      5






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      8














      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






      share|improve this answer





















      • 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 '17 at 0:25


















      8














      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






      share|improve this answer





















      • 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 '17 at 0:25
















      8












      8








      8







      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






      share|improve this answer















      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







      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Mar 31 '15 at 14:26

























      answered Oct 12 '14 at 16:05









      Makhlouf GHARBIMakhlouf GHARBI

      20126




      20126








      • 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 '17 at 0:25
















      • 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 '17 at 0:25










      2




      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 '17 at 0:25







      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 '17 at 0:25















      1














      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






      share|improve this answer


























      • shouldn't I use wlan0 instead?

        – アレックス
        Feb 20 '14 at 10:16











      • I want to change mac address for wifi. I can't do this when I use wlan0.

        – アレックス
        Feb 20 '14 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 '17 at 11:07
















      1














      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






      share|improve this answer


























      • shouldn't I use wlan0 instead?

        – アレックス
        Feb 20 '14 at 10:16











      • I want to change mac address for wifi. I can't do this when I use wlan0.

        – アレックス
        Feb 20 '14 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 '17 at 11:07














      1












      1








      1







      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






      share|improve this answer















      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







      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited May 30 '14 at 1:10









      andrew.46

      22.5k1470150




      22.5k1470150










      answered Feb 20 '14 at 8:20









      smn_onrockssmn_onrocks

      366110




      366110













      • shouldn't I use wlan0 instead?

        – アレックス
        Feb 20 '14 at 10:16











      • I want to change mac address for wifi. I can't do this when I use wlan0.

        – アレックス
        Feb 20 '14 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 '17 at 11:07



















      • shouldn't I use wlan0 instead?

        – アレックス
        Feb 20 '14 at 10:16











      • I want to change mac address for wifi. I can't do this when I use wlan0.

        – アレックス
        Feb 20 '14 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 '17 at 11:07

















      shouldn't I use wlan0 instead?

      – アレックス
      Feb 20 '14 at 10:16





      shouldn't I use wlan0 instead?

      – アレックス
      Feb 20 '14 at 10:16













      I want to change mac address for wifi. I can't do this when I use wlan0.

      – アレックス
      Feb 20 '14 at 10:46





      I want to change mac address for wifi. I can't do this when I use wlan0.

      – アレックス
      Feb 20 '14 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 '17 at 11:07





      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 '17 at 11:07











      1














      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.






      share|improve this answer






























        1














        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.






        share|improve this answer




























          1












          1








          1







          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.






          share|improve this answer















          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.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Oct 10 '17 at 10:34

























          answered Jul 3 '17 at 8:54









          YokaiYokai

          1239




          1239























              0














              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






              share|improve this answer



















              • 1





                Instead of posting a link only please transcribe the answer here in detail. Thanks

                – Wild Man
                Jun 11 '16 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 '16 at 3:58
















              0














              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






              share|improve this answer



















              • 1





                Instead of posting a link only please transcribe the answer here in detail. Thanks

                – Wild Man
                Jun 11 '16 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 '16 at 3:58














              0












              0








              0







              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






              share|improve this answer













              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







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Jun 11 '16 at 2:42









              HarinderHarinder

              1




              1








              • 1





                Instead of posting a link only please transcribe the answer here in detail. Thanks

                – Wild Man
                Jun 11 '16 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 '16 at 3:58














              • 1





                Instead of posting a link only please transcribe the answer here in detail. Thanks

                – Wild Man
                Jun 11 '16 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 '16 at 3:58








              1




              1





              Instead of posting a link only please transcribe the answer here in detail. Thanks

              – Wild Man
              Jun 11 '16 at 3:39





              Instead of posting a link only please transcribe the answer here in detail. Thanks

              – Wild Man
              Jun 11 '16 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 '16 at 3:58





              @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 '16 at 3:58











              0














              http://www.microhowto.info/howto/change_the_mac_address_of_an_ethernet_interface.html



              SEE THIS



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






              share|improve this answer




























                0














                http://www.microhowto.info/howto/change_the_mac_address_of_an_ethernet_interface.html



                SEE THIS



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






                share|improve this answer


























                  0












                  0








                  0







                  http://www.microhowto.info/howto/change_the_mac_address_of_an_ethernet_interface.html



                  SEE THIS



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






                  share|improve this answer













                  http://www.microhowto.info/howto/change_the_mac_address_of_an_ethernet_interface.html



                  SEE THIS



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







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Apr 7 at 5:37









                  DragonDragon

                  1




                  1






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Ask Ubuntu!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f423530%2fcant-change-my-mac-address-cant-assign-requested-address%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      數位音樂下載

                      When can things happen in Etherscan, such as the picture below?

                      格利澤436b