# changing eth0 and eth1 detection order

## mindseyex2

My firewall's built in ethernet card kicked the bucket, so I need to change the device order to make another card (currently eth1) become eth0.

Right now there are 3 cards in the system:

```

eth0 built in 8139too (old public interface)

eth1 3c59x (currently unused)

eth2 e1000 (lan side)

```

I have a lot of scripts configured to reference eth0 and eth2, so I would prefer not to have to re-write them if at all possible.  I edited /etc/modules.d/aliases and then ran modules-update.  At this point /etc/modules.conf show up correctly as follows:

```

alias eth0 3c59x

alias eth1 8139too

alias eth2 e1000

```

On boot though, it is still trying to load the 8139too as eth0, not the 3c59x.

Any suggestions?  I havent tried disabling the 8139too in the bios yet, and i'll do that now, but I have a suspicion that it will change the device order of the other cards too.

----------

## NeddySeagoon

mindseyex2,

Build the drivers as modules then list them in /etc/modules.autoload.d/kernel-2.6 in the order you want them loaded.

eth0 will belong to the first loaded ethernet module

eth1 the second ...

----------

## mindseyex2

That was it, thank you

----------

## Praxxus

FYI:  Build the module you want to be eth0 into the kernel, and build eth1 as a loadable module.

That also works.

----------

## UberLord

Write a udev rule to name each device explicitly - say lan and wlan.

http://reactivated.net/writing_udev_rules.html

----------

## Praxxus

 *UberLord wrote:*   

> Write a udev rule to name each device explicitly

 

Wow UberLord, what a delightfully non-hackish solution!  Thanks!

----------

## bwins46

I have two ethernet interfaces and a firewire interface, the three interfaces would show up randomly as eth0, eth1 and eth2.  I created some udev rules to sort out my interfaces but have a problem with the firewire rule not taking effect, maybe I have done something wrong..

my rules:

```

lucky rules.d # cat 15-local-net.rules

KERNEL=="eth*", SYSFS{address}=="00:11:09:6a:45:53", NAME="vpnlan"

KERNEL=="eth*", SYSFS{address}=="00:09:5b:8d:6d:1e", NAME="loclan"

KERNEL=="eth*", SYSFS{address}=="00:10:dc:00:00:7a:09:6c", NAME="fwlan"

```

On reboot, the rules for 'vpnlan' and 'loclan' are applied correctly but the fwlan rule doesn't seem to be applied.  I have three interfaces visible in ifconfig: vpnlan, loclan, and eth0.

running udevtest yeilds: (firewire is eth0 in this test)

```

lucky sys # udevtest /class/net/eth0

main: looking at device '/class/net/eth0' from subsystem 'net'

wait_for_sysfs: file '/sys/class/net/eth0/address' appeared after 0 loops

udev_rules_get_name: rule applied, 'eth0' becomes 'fwlan'

rename_net_if: changing net interface name from 'eth0' to 'fwlan'

udev_add_device: renamed netif to 'fwlan'

main: run: '/sbin/udev_run_devd net'

main: run: 'socket:/org/kernel/udev/monitor'

```

firewire configuration

```

lucky ~ # dmesg | grep  1394

ieee1394: Initialized config rom entry `ip1394'

ohci1394: fw-host0: OHCI-1394 1.0 (PCI): IRQ=[5]  MMIO=[fdffe000-fdffe7ff]  Max Packet=[2048]  IR/IT contexts=[4/8]

ieee1394: Host added: ID:BUS[0-00:1023]  GUID[0010dc00007a096c]

eth1394: eth0: IEEE-1394 IPv4 over 1394 Ethernet (fw-host0)

```

System is an MSI K8N Neo Socket 754 motherboard, 2G RAM, onboard ethernet (forcedeth), onboard firewire, and netgear (natsemi) pci ehternet card.

```

lucky ~ # uname -a

Linux lucky 2.6.16-gentoo-r2 #1 PREEMPT Fri Apr 14 20:03:58 EDT 2006 i686 AMD Athlon(tm) 64 Processor 3200+ GNU/Linux

```

What have I missed?

----------

## bwins46

I noticed the firewire interface displayed a number of 'extra' zeros in the HWaddr field through ifconfig. I modified my udev rules to include the longer field and that seems to work, all interfaces are now renamed properly.

```

lucky ~ # cat /etc/udev/rules.d/15-local-net.rules

KERNEL=="eth*", SYSFS{address}=="00:11:09:6a:45:53", NAME="vpnlan"

KERNEL=="eth*", SYSFS{address}=="00:09:5b:8d:6d:1e", NAME="loclan"

KERNEL=="eth*", SYSFS{address}=="00:10:dc:00:00:7a:09:6c:00:00:00:00:00:00:00", NAME="fwlan"

```

Now all my interfaces maintain their names    :Smile: 

----------

## synss

udev related problem: does not rename interface

EDIT: solved, udev expected lower case, copy-pasted higher case from the log files...

----------

