Wednesday, February 29, 2012

How to change nic mac address remotely without lose connection? (solution)

If you are on local computer, to change mac address you need to:
ifdown eth0
ifconfig eth0 hw ether xx:xx:xx_mac_address
ifup eth0 


Attention, you cannot do this when remotely connected, 
because "ifdown eth0" will disable nic and this mean no more network connection. 
You can try to change mac address remotely (i've succeed to) with this simple trick. (focus-pokus) :) 


Make one file 'nicmac.sh' with: 
 #!/usr/bin/env bash 
ifdown eth0 
ifconfig eth0 hw ether xx:xx:xx_mac_address  # example: 50:aa:49:99:4a:00 
ifup eth0 
 #--End of file 'nicmac.sh' 


Then: 
lnx#> chmod a+x nicmac.sh' 
lnx#> sudo -s './nicmac.sh' 


And voila, you have new mac address changed remotely.

No comments:

Post a Comment