Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am doing a test on MAC learning and for that ,I need to change my MAC address of linux machine while the interface is UP. To be more clear, consider eth1 in a fedora core 8 machine. And while the interface is UP. I am running a script which changes the MAC address from 10:1:1:1:1:1 to 50:50:50:50:50:50 (i.e 50 times MAC address is changed) . When I try to change the MAC address when the interface it UP, it gives me the following error :

siocsifhwaddr : device or resource busy

I know the way of changing the MAC address by bringing down the interface but I need to know if this can be done while the interface is UP.

Any help in this is really appreciated. thanks aditya

share|improve this question
add comment

migrated from stackoverflow.com Jun 25 '10 at 1:30

This question came from our site for professional and enthusiast programmers.

2 Answers

The limitation is coming from the Ethernet driver in question. Some drivers will allow you to do this, others won't.

If you need to not bring the link up and down (i.e., if you are testing the MAC table of a switch which flushes when the link goes down), you can stick another switch or hub in between the equipment under test and your computer.

share|improve this answer
    
@theatrus that will not help me because I have the scripts for changing the MAC address on the linux machine, i need to change on the linux machine and then learn the MAC on DUT. I did not understand how the hub will help. Even the hub or switch will not see the changed MACs –  Adi Jun 24 '10 at 22:29
2  
@Adi: What prevents you from taking the interface down and up? Perhaps if you explain your problem/issue better I can give a better solution. –  theatrus Jun 24 '10 at 22:33
    
That would be my last option, because I configure IP address on the interface, so if i bring it down , all the dynamic information may be lost which I dont want. –  Adi Jun 24 '10 at 22:34
add comment

using ifconfig

ifconfig < interface > hw < class > < address >

never done this myself, so I cant say for sure that it works.

share|improve this answer
    
i know this, ifconfig eth1 hw ether 1:1:1:1:1:1 works but only if you do ifconfig eth1 down and then make it up again, I dont want to do that thing, –  Adi Jun 24 '10 at 22:30
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.