Switch eth0 and eth1, how?

Frantisek Hanzlik franta at hanzlici.cz
Fri Oct 19 22:18:04 UTC 2012


JD wrote:
> 
> On 10/19/2012 03:35 PM, Fernando Cassia wrote:
>> In my server I have eth0 and eth1 (previously were em16, em17, but I
>> hated it so I changed to the traditional approach).
>>
>> Each NIC port is connected to a different ISP. However, more often
>> than not while moving things around I get the cables reversed so ETH0
>> goes to ISP2 and ETH0 goes to ISP2, or vice versa, ie the cables are
>> interchanged.
>>
>> So... is there a way, in such situation, to manually (say, from a bash
>> script) bring down both eth ports, and re-arrange those? (so that eth1
>> becomes eth0), and do so without a reboot?.
>>
>> I´d like to make eth0 and eth1 consistent regardless of mixed cabling
>> so every time I bring down eth0 I know what isp I´m bringing down.
>> What IP each port is connected to I can figure out via a query to
>> www.whatismyip.com, but the question remains if it´s possible to
>> change the naming of two ethernet ports without a reboot.
>>
>> What would be the best way? ethtool?
>>
>> TIA
>> FC
> While I do not know how to answer your question,
> I would LOVE to know how you got away from the
> emXY naming , to the traditional ethX naming.
> I have been trying to do so for a long time and no
> one on the list has been able to provide a working
> solution. Fixing /etc/udev/rules.d/70-persistent-net.rules
> does not help at all.
> 
> Thanx.

Uninstalling 'biosdevname' (rpm -e biosdevname/yum remove biosdevname)
and setting '/etc/udev/rules.d/NN-my-network.rules' should be sufficient.
Note at F17 is necessary manually create this rule file, something as:

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*",
ATTR{address}=="00:1e:8c:93:b5:8d", ATTR{dev_id}=="0x0", ATTR{type}=="1",
KERNEL=="eth*", NAME="eth0"

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*",
ATTR{address}=="00:1b:21:69:5f:74", ATTR{dev_id}=="0x0", ATTR{type}=="1",
KERNEL=="eth*", NAME="eth1"




More information about the users mailing list