Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Say I have eth0 - my management interface, then eth1 with mac1 and eth2 with mac 2- additional nics running. How can I reassign eth1 with mac2 and eth2 with mac1 and bring them up without the reboot?

share|improve this question
1  
Why do you need to swap the mac adddress? –  Zypher Mar 4 '13 at 22:19
    
Put'em down, change addresses, then put'em up again. –  poige Mar 4 '13 at 22:29
    
What Linux distribution? –  Michael Hampton Mar 4 '13 at 22:34
    
I tried to put them down, change the HWADDR entries in /etc/sysconfig/network-scripts/ifcfg-eth1 and ifcfg-eth2, change the entries in /etc/iftab, then do ifrename and service network restart or ifdown/ifup eth1 and eth2 - doesn't work without reboot. Any ideas? –  alex Mar 4 '13 at 22:55
    
put them down, change eth2 mac address first to other address, e.g: ifconfig eth2 hw ether 00:11:22:33:44, then ifconfig eth2 w.x.y.z netmask ww.xx.yy.zz up. do it for eth1 (using eth2 mac addr), and then change eth2 mac addr using old eth1 mac addr. –  chocripple Mar 5 '13 at 8:13

2 Answers 2

Edit file /etc/init.d/network

You can comment/remove line ./ifdown $i boot from below

action $"Shutting down interface $i: " ./ifdown $i boot

like this :

action $"Shutting down interface $i: " 

       # ./ifdown $i boot

to stop system from reboot on /etc/init.d/network restart.

You will have to check whether mac addresses gets changed by doing this. Or you will have to reboot the system.

share|improve this answer

You can use the ip command to change the name of an interface.

  1. assign eth0 the new name swapit
  2. assign eth1 the new name eth0
  3. assign swapit the new name eth1
share|improve this answer

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.