[techtalk] Numbering of eth

Malcolm Tredinnick malcolm at commsecure.com.au
Wed Jul 18 21:38:56 EST 2001


On Wed, Jul 18, 2001 at 02:28:08PM +0200, Magni Onsoien wrote:
> Just a very quick question before I rush out to replace a firewall: My
> workmate says that he is pretty sure that the network interfaces under
> Linux used to be numbered (by linux) due to their ethernet address, i.e.
> lowest mad-address became eth0, next one eth1 etc.

No, this is not correct. It numbers them in the order they are detected,
which is more low-level hardware stuff. I can't be more concrete than
that because it's all a mystery to me down at that level.

> However, I have a server with 3 3c59x cards in, and the one in the first
> (uppermost when counted from top of motherboard) PCI slot is eth0, the
> next one eth1 and the lowest one eth2. Strange (?) thing is that this is
> so even though the mac addresses are opposite - lowest mac address is
> eth2, highest eth0.
> 
> My mate is a bit confused, but my idea is that this is a) because I have
> Linux 2.4.3 and this kernel numbers the interfaces due to what slot they
> are in, b) because this is PCI and not ISA and then any kernel numbers
> them due to PCI slot and c) randomness in moon shadow.

Your item (c) has a lot to do with it, in practice. :-)

> This is very reproducable so I KNOW it's correct on this server now, the
> reason why I ask is that IF this bloody firewall doesn't work I might
> have to put in the old one, with a 2.0 kernel and ipfwadm. Then it's
> kind of essensial that the numbering of the interfaces is right..
> So, can I rely on even the 2.0-kernel to number them correctly (due to
> PCI slot number, not by increasing mac address), or should I be prepared
> for numbering by increasing mac addresses?

I'm not really sure what your concern is here. The ordering is
deterministic: that is, from reboot to reboot, it will stay the same. So
why can't you boot the box once, look at which ethernet card gets which
ethX value and then away you go? You generally only deal with an
ethernet card as ethX at startup. Once they have IP numbers assigned you
can use those and forget their interface names. So even if they come up
in a different order, it shouldn't be that big a deal, should it?

Cheers,
Malcolm

-- 
Bills travel through the mail at twice the speed of cheques.




More information about the Techtalk mailing list