# udev and eth(X) [not quite SOLVED???]

## pratttech

Hope someone has been through this same exact thing before.  It's way late here and my eyes are having a tough time focusing at this point.   :Shocked: 

I'm sure I could dig some more tomorrow, but oh how nice it would be to go to bed and have the answer waiting for me when I awake.   :Wink: 

I have two ethernet interfaces on my laptop both of which I setup as modules.  I don't have either come up at boot since I'm not sure where I'll be or how connected.  Whichever comes up first right now is grabbing eth0.  

I seem to recall in the install documentation that udev was the next generation devfs for this very reason; it could keep track of devices regardless of where they show up (or don't) on the bus.  I was thinking about differing extra hard drives in my UltraBay when I selected udev over devfs, but this popped up first.

Anyone use udev in a similar situation and have a way to force eth0 and eth1 regardless of whether eth0 is up at the time I want to bring up eth1? 

Or does it even matter?  I usually dhcp both interfaces, so conf.d/net doesn't really need to change.  I just need some way to change iwconfig values on the fly depending on which AP I want to associate with for the wifi if.Last edited by pratttech on Sun Sep 26, 2004 7:36 pm; edited 2 times in total

----------

## Chewi

I currently use udev on my laptop to call my wireless card net.atheros and my other card net.rtl8139. It's much better like this and it's quite easy to do. Create /etc/udev/10-nics.rules.

# Atheros wireless NIC

KERNEL="ath*", SYSFS{address}="00:0e:9b:01:b9:4d", NAME="atheros"

# 8139 PCI NIC

KERNEL="eth*", SYSFS{address}="08:00:46:cf:cf:d0", NAME="rtl8139"

Find out your MAC addresses in the files called address in /sys/class/net. Don't forget to update your scripts and configs accordingly.

----------

## pratttech

Thanks for the help Chewi.  So by doing this I could rename my interfaces from eth0 and eth1 to whatever I want?  I could actually name them after my drivers e100 and orinoco?  Would I then need a net.e100 and a net.orinoco in my init.d?

----------

## Chewi

That's exactly it, yep.

----------

## psy_ill

I tried the udev trick, but I can't get it to work. I have two network cards, both using the tulip driver and both are recognized as eth0 and eth1 respectively.

Now, I wanted to rename them to make sure their order doesn't interfere with my setup, so I added the following lines to my /etc/udev/rules.d/10-local.rules:

KERNEL="eth?", SYSFS{address}="00:08:a1:5a:1d:6d", NAME="mylan"

KERNEL="eth?", SYSFS{address}="00:50:fc:18:02:90", NAME="mygate"

Then, I symlinked /etc/init.d/net.mylan and /etc/init.d/net.mygate to /etc/init.d/net.eth0, added the two symlinks with rc-update and removed net.eth0 with rc-update.

I also changed /etc/conf.d/net, the rows

ifconfig_eth0=...

ifconfig_eth1=...

to

ifconfig_mylan=...

ifconfig_mygate=...

But when I boot, it seems like the devices mylan and mygate doesn't exist. Is it a bug in the documentation or am I misunderstanding the flexibility of gentoo?

----------

## chunderbunny

```
KERNEL="eth?", SYSFS{address}="00:08:a1:5a:1d:6d", NAME="mylan"

KERNEL="eth?", SYSFS{address}="00:50:fc:18:02:90", NAME="mygate"

```

Shouldn't that be 

```
KERNEL="eth*", SYSFS{address}="00:08:a1:5a:1d:6d", NAME="mylan"

KERNEL="eth*", SYSFS{address}="00:50:fc:18:02:90", NAME="mygate"

```

Or perhaps that was just a typo?

----------

## psy_ill

Never mind my problem, I just upgraded from udev-030 to udev-032 and it works.

The use of "?" instead of "*" is not important, "?" matches only one character, "*" matches several. It doesn't matter in this case.

----------

## pratttech

Okay, just got around to trying this and I think that I have the same error psy_ill experience.  

How do you verify this?  I'm guessing ifconfig's output, but I still get eth0 and eth1.

I double-checked my syntax and it looks fine.  Even tried with both upper and lower case on hex 11-15.  Neither made a difference.  I am also running udev-030.

When I 'emerge -p udev' it just wants to rebuild 030.  Is udev-032 not in x86 yet and only in ~x86?

Any ideas other than upgrading udev?

----------

## Chewi

I reckon upgrading udev may be your only option. If it is ~x86 then you could put this in /etc/portage/package.keywords...

sys-fs/udev ~x86

----------

## pratttech

So I masked udev and emerged.  Wierd thing is-- psy_ill talks of udev-032 and with mask of ~x86 mine only went to udev-031.  So I upgraded but IT DIDN"T WORK EITHER!   :Crying or Very sad: 

Anyway now I'm starting to doubt myself so I copied the contents of 10-nics.rules for your review:

# Intel PRO/100 

KERNEL="eth*",SYSFS{address}="00:02:8a:2d:a1:9d",NAME="wire"

# Cabletron (Enterasys) RoamAbout 802.11 DS

KERNEL="eth*",SYSFS{address}="00:01:f4:ec:e4:b4",NAME="wifi"

Edit:  Just decided to do an emerge sync since it had been a few days.  This brought udev up to 032.  Building now. with fingers crossed   :Wink: 

----------

## Chewi

Looks okay to me. Did you emerge sync lately? Also check /sys/class/net and see what's going on in there.

----------

## pratttech

Well 032 is no go either.  I checked /sys/class/net/eth0/address and it matches what I used in my rules.  Is there anything else I need to check in this dir?

----------

## Chewi

Is eth0 and eth1 all you have in /sys/class/net? And this may seem like a stupid question but are you sure your system is using udev? You either have to leave devfs support out of the kernel or add gentoo=nodevfs to your boot parameters.

----------

## pratttech

I built my kernel without devfs.  Beside my external interfaces I also have lo.  eth0 and eth1 only show up when I load the modules for them.  Right now I left my pcmcia subsystem off, so only eth0 and its the wired if right now.

----------

## Chewi

Hmmm. You've got me stumped.

----------

## pratttech

Me too   :Wink: 

Not the end of the world, as both devices work just fine.  It is just the confusion of who ends up as eth0 if I bring them up at the same time, which almost never happens.

I'll keep digging because this is cool stuff if I can get it to work.  Thanks for the help Chewi.  Let me know if you think of anything else.

----------

## Chewi

Heh I just noticed while doing a general update of my system that I've only had udev-30 all this time.

----------

## kevquinn

You could try enabling udev logging (/etc/udev/udev.conf) and see what it says in your system log.

Personally I use hotplug to start the network interfaces, rather than setting them permanently with rc-update; only net.lo is started at boot. The symlinks exist in /etc/init.d, but they're not installed in the runlevels.

----------

## pratttech

I installed hotplug so I didn't need to manually load gpilotd.  I also unmasked the new baselayout to get the wireless-tools inclusion.  After that it is just coming up correctly as I labled earlier in this thread:

 *Quote:*   

> 
> 
> root@privateer ~ # ifconfig
> 
> lo        Link encap:Local Loopback
> ...

 

----------

