# udev cant match realtek NIC [SOLVED: rules file ordering]

## Gentree

```
lspci:

01:06.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+ (rev 10)

bash-4.1#lsmod|grep 8139

8139cp                 14513  0 

8139too                15134  0 

```

udevadm trigger produces the following in /var/log/messages:

```

Sep 12 14:16:01 linbox rc-scripts: net.eth1 is not allowed to be hotplugged

```

using udev rule:

```

cat 10-local.rules |grep -e ^[^#]

KERNEL=="eth*", ACTION=="add", DRIVERS=="forcedeth", NAME="eth_mobo" 

KERNEL=="eth*", ACTION=="add", DRIVERS=="3c59x", NAME="eth_emb" 

KERNEL=="eth*", ACTION=="add", DRIVERS=="e100", NAME="eth_pci" 

KERNEL=="eth*", ACTION=="add", DRIVERS=="8139cp", NAME="eth_real"

```

```
rmmod 8139cp 

rmmod 8139too

udevadm trigger 
```

produces the following:

```
Sep 12 14:32:54 linbox kernel: 8139too Fast Ethernet driver 0.9.28

Sep 12 14:32:54 linbox kernel: 8139too 0000:01:06.0: PCI INT A -> Link[APC3] -> GSI 18 (level, high) -> IRQ 18

Sep 12 14:32:54 linbox kernel: eth0: RealTek RTL8139 at 0xc000, 00:08:a1:73:74:e9, IRQ 18

Sep 12 14:32:54 linbox kernel: 8139cp: 10/100 PCI Ethernet driver v1.3 (Mar 22, 2004)

Sep 12 14:32:54 linbox kernel: udev: renamed network interface eth0 to eth1

Sep 12 14:32:54 linbox rc-scripts: net.eth1 is not allowed to be hotplugged
```

eth1 is blocked in /etc/conf.d/rc to stop unmatched cards from lauching dhcp on boot and screwing up resolv.conf.

So the expected module is loaded for that nic . Why doesn't udev match the rule and rename it eth_real instead of the unconfigured eth1 ??

TIA, Gentree.   :Cool: 

----------

## krinn

oh you again  :Very Happy: 

because of the rule ?

```
KERNEL=="eth*", ACTION=="add", DRIVERS=="8139cp", NAME="eth_real" 
```

and the 

```
Sep 12 14:32:54 linbox kernel: 8139too Fast Ethernet driver 0.9.28

Sep 12 14:32:54 linbox kernel: 8139too 0000:01:06.0: PCI INT A -> Link[APC3] -> GSI 18 (level, high) -> IRQ 18

Sep 12 14:32:54 linbox kernel: eth0: RealTek RTL8139 at 0xc000, 00:08:a1:73:74:e9, IRQ 18

Sep 12 14:32:54 linbox kernel: 8139cp: 10/100 PCI Ethernet driver v1.3 (Mar 22, 2004) 
```

this part clearly show 8139too driver load, then discovering a card, then loading 8130cp.

So 8139too is the correct driver and your rules ask 8139cp one

I'm not sure it's that but one sure thing

70-persistent-net.rules must have eth0 recorded with the mac address of eth_mobo or eth_pci, so udev rename it to eth1.

just edit 70-persistent-net-rules and change eth0 with eth_pci

then change eth1 to eth_real

and then, even if the local.rules fail, udev should rename the interface to eth_real because it has record it's mac address

It's easier, no rules at all for your card, only default rules, let udev name them as it wish (eth0, eth1...) and using the 70-persistent.... file ask udev to name them as YOU wish this time.

----------

## Gentree

Sorry, I thought I had noted that it did the same with either module name . (Probably in the other thread.)

/etc/udev/rules.d/10-local.rules :

```
KERNEL=="eth*", ACTION=="add", DRIVERS=="8139too", NAME="eth_real"
```

```

Sep 12 18:56:41 linbox kernel: 8139too Fast Ethernet driver 0.9.28

Sep 12 18:56:41 linbox kernel: 8139too 0000:01:06.0: PCI INT A -> Link[APC3] -> GSI 18 (level, high) -> IRQ 18

Sep 12 18:56:41 linbox kernel: eth0: RealTek RTL8139 at 0xc000, 00:08:a1:73:74:e9, IRQ 18

Sep 12 18:56:41 linbox kernel: 8139cp: 10/100 PCI Ethernet driver v1.3 (Mar 22, 2004)

Sep 12 18:56:41 linbox kernel: udev: renamed network interface eth0 to eth1

Sep 12 18:56:41 linbox rc-scripts: net.eth1 is not allowed to be hotplugged

```

hey! thank you for pointing me at the persistant rules file. There I find a note I made:

 *me wrote:*   

> ##### take out these rules for onboard devices that are pre-empting 10-local.rules !!

 

Duh! I was thinking the lower numbers got read first , it looks like it's decending order!!

My rule never got read because the event had be dealt with already.  In fact I need to put these rules in 99*.rules so they get precedence. 

I'd switched from using mac addresses since I have a similar reserve mobo that has the same chipset and onboard "eth_mobo" with a different mac. Using module names meant I could swap hardware (when I  get a bad BIOS or a lightning strike) and reboot without reconfiguring. 

I guess I just decided to use the same system for all nics. 

Anyway , once again you have helped me see what I was missing and my gentoo box thanks you heartily.

You've probably spared it getting a bit of option 5 treatment  :Wink: 

Merci.   :Cool: 

----------

