# NIC switch order problem

## sgao

Hi,

Not sure if anyone has seen the similar problem with Dell PE 1950. The machine comes with two onboard NIC (Broadcom 5708 ExTreme II). If two NIC both enabled in the BIOS, NIC1 will be recognized as eth1, NIC2 as eth0 (The correct order should be NIC1 -> eth0, NIC2 -> eth1), after the machine boots up.

I have tried reinstalling the machine with NIC2 disabled first. If NIC2 is disabled, then the machine recognized NIC1 and assigned eth0 after boot up. However, if NIC2 is re-enabled again, the NIC switch order problem comes back after the machine boots up.

Why this kind of problem happens? a kernel bug? Gentoo bug? Is there any way to set NIC1 stick to eth0, NIC2 to eth1?

Simon Gao

----------

## wynn

 *Quote:*   

> Is there any way to set NIC1 stick to eth0, NIC2 to eth1? 

  As they are both the same device, they use the same driver. If they had different drivers, you could try setting the order on /etc/modules.autoload.d/kernel-2.6.

However, NeddySeagoon has pointed out in another thread that this cannot be relied on and the only way to fix the order in which they are assigned by the kernel is writing new udev rules.

An aside: if they are both the same device, both on the motherboard, why does it matter that "NIC1 will be recognized as eth1, NIC2 as eth0"?

----------

## darkseer

because if you have 2 nics and you are using the machine as a router its a problem. iptables references the NIC by the name given by the OS, ehtN. So when eth1 and eth0 switch places you are all of a sudden routing the internet to you internal network instead of the internal network to the internet. (not completely true but I thought it was funny) I have a similar problem with 3 nics of different makes in the same machine. When I cold boot the nics order in one way, when I warm boot they order differently. It is as if pressing the reset button has a different effect than the power button. I'm looking into the udev mojo myself right now. I'm a udev noob so it is taking me some time.

----------

## sgao

It does not work for Gentoo. I've tried udev rules and other things. eth0 is always bound to NIC2 (port2), eth1 to NIC1 (port1). 

The problem is that I want to run Xen on the machine. Such nic mis-order messes up bridging, routing and makes Xen broke.

I have contacted Dell. They said they had to either re-engineer their motherboard to get it working with kernel 2.6, or get kernel developers rewrite/modify their codes to make kernel 2.6 work with PE 1950 correctly. To me, this is more a design problem than kernel issue.  I guess a fix won't be any time soon. 

Simon

----------

## Corona688

You can rename them with udev rules like so:

```
KERNEL="eth*", SYSFS{address}=="55:55:55:55:55:55", NAME="lan"

KERNEL="eth*", SYSFS{address}=="66:66:66:66:66:66", NAME="wlan"
```

 Two things of note.

Make sure the mac address you enter is lower case.

Don't try and rename them to eth[n], all it takes is adding a new ethernet card and bam, you've got a new eth0 that blows all your rules out of the water.  Give them unique names like above.

----------

## sgao

This is a problem with PE1950 hardware. It's up to Dell to fix it.

Simon

----------

## dermot

I came across the exact same thing in FreeBSD so it's not a Linux problem, it's a hardware problem. I'm not even sure that it's a problem either - it's a bit confusing that eth0 is physically labelled as '2' and eth1 is physically labelled as '1' but other than that I don't see what difference it makes or why it would affect bridging and routing or NATting or whatever. As long as you remember that NIC1 corresponds to eth1 and NIC2 corresponds to eth0 and patch accordingly, you're set.

----------

