Re: How does "alias ethX drivername" in modules.conf work?

From: Riley Williams (rhw@MemAlpha.CX)
Date: Mon Aug 06 2001 - 17:56:07 EST


Hi Thomas.

>> One of my systems has SIX ethernet cards, these being three ISA
>> and two PCI NE2000 clones and a DEC Tulip. Here's the relevant
>> section of modules.conf on the system in question:

>> Q> alias eth0 ne
>> Q> options eth0 io=0x340
>> Q> alias eth1 ne
>> Q> options eth1 io=0x320
>> Q> alias eth2 ne
>> Q> options eth2 io=0x2c0
>> Q> alias eth3 ne2k-pci
>> Q> alias eth4 ne2k-pci
>> Q> alias eth5 tulip

> ok, well this makes sense for the ISA cards. I have card A in my
> hand, I set the jumpers on it to an io port 0x340, stick it in
> slot X on my computer, plug the wire into it from network 1,
> then I mentally can map all the stuff together, so I know how to
> setup the network in Linux

> eth0 == io 0x340 == card A == slot X in my computer == network 1

> but, how can you tell the difference between eth3 and eth4 --
> and specify which *physical* card gets assigned to which virtual
> eth? name...ie, how do I know which pci slot is which eth?

That depends on the driver used to map those cards. Here's what I know
so far, mainly from experimentation:

 1. The ne2k-pci driver assigns cards in ascending ethernet address
    on this machine.

 2. On the same machine, when I had three tulip cards installed, the
    tulip driver assigned them in descending ethernet address.

 3. Both of the above results are independant of the order the cards
    are plugged into the PCI bus.

As a result, there is no simple answer to your question, and the
answer above probably depends to a large extent on factors other than
the card itself.

However, if the cards are controlled by different drivers, you can
influence the order they are detected in by your choice of entries in
modules.conf - in the example above, the ISA cards are always eth0,
eth1 and eth2, the NE2k-pci cards are always eth3 and eth4, and the
tulip card is always eth5, simply because that's what the said file
says.

> besides reading the motherboard documentation and maybe learning
> which direction and how the pci bus is ordered...which can
> differ between motherboard manufacturers and BIOS's, etc, etc.

Remember that every ethernet card has an ethernet address assigned to
it, this being the "HWaddr" reported by `ifconfig` and (in theory at
least) these are all unique. All you need to do is to determine the
ethernet address of each of the cards in your system, then see which
interface has that ethernet address assigned to it, and you've found
the match...

> and how do I change it if I don't like the default order (based
> off of pci scan order). what if I want card B, a pci card stuck
> in PCI slot Y to be eth4?

You could always add "options eth? io=0x????" lines for the PCI ports,
and hope the addresses you've specified don't get changed, but I'll
not guarantee this works as I've never tried it.

Probably of more use is to set the IP address for a particular
interface dependant on the ethernet address of the card supplying it.
The enclosed bash script should achieve that - it's basically the
`ifconfig` command with the port name replaced by its ethernet
address, but it only works for "eth?" ports. I've tried it on my
system, and it does the job it's designed to, but YMMV...

> I hope this is clearer...

I hope this helps...

Best wishes from Riley.



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Aug 07 2001 - 21:00:41 EST