(?) The Answer Gang (!)


By Jim Dennis, Ben Okopnik, Dan Wilder, Breen Mullins, Mitchell Bruntell, the Editors of Linux Gazette... and You!
Send questions (or interesting answers) to tag@lists.linuxgazette.net


(?) Renaming Ethernet Devices

From Matthew Keller

Answered By Mike Orr, Heather Stern

Ok, so this is probably a trivial problem, but it's one I've had for years. If I have 3 Ethernet devices (eth0,eth1,eth2), I want to be able to tell Linux WHICH one I want to be which. If they are of different kinds (or at least have different drivers) I can fool Linux by specifying them in /etc/conf.modules (or modules.conf for RH7 users) and defining which card gets which name. How do I do that if they're all the same kind?!

(!) [Mike] I've tried to do that before too, but I haven't found a way. It seems like a glaring ommission. I just use different brands of cards, and then I can decide which order to insmod the modules. Obviously, each card is attached to a different network, and it's important to know card X is eth0 so you can configure the right card for the right network.
The worst part is, if the first card is removed or fizzles out, the second card becomes eth0, and your startup script will initialize the wrong card, and presto, no network.
You may find they get detected in order of hardware address. PCI slots have fixed addresses, so you may be able to move the cards among different slots and get the order you want.
(If they were ISA cards like the 3C509, you would the DOS program 3C5X9.EXE to set the hardware address on each card. Other ISA cards you would set jumpers on, if you're lucky enough to find documentation about which setting is which! Dunno about plug n play, but on the 3C509 you can turn off plug n play using the same program. You could also use LILO's "ether=" parameter to specify which order you want the hardware addresses probed.)

(?) What brings this to mind now, is that I have a new server, fresh install, one on-motherboard Intel NIC and 2 PCI NIC's. Linux picked the first PCI NIC to be Eth0, the second to be Eth1 and the on-board to be Eth2, and I'm just demented enough to argue with it. :)

Matthew Keller

(!) [Heather] Well, I don't know, but in the linux source tree under /Documentation/networking/net-modules.txt several common options are described for explicitly setting options such as I/O address rather than allowing autoprobing. It also says that for many cards, explicitly stating is better for them than autoprobing anyway. But the important part is it directly addresses part of the question... namely, how one would use two cards with the same driver, because at least under the 8390 family (cheap old cards, such as ne2000):
	In many cases it is highly preferred that insmod:ing is done
	ONLY with defining an explicit address for the card, AND BY
	NOT USING AUTO-PROBING!
...
	8390 based Network Modules		(Paul Gortmaker, Nov 12, 1995)
	--------------------------

(Includes: smc-ultra, ne, wd, 3c503, hp, hp-plus, e2100 and ac3200)

The 8390 series of network drivers now support multiple card systems without 
reloading the same module multiple times (memory efficient!) This is done by 
specifying multiple comma separated values, such as:

	insmod 3c503.o io=0x280,0x300,0x330,0x350  xcvr=0,1,0,1

The above would have the one module controlling four 3c503 cards, with card 2
and 4 using external transceivers. The "insmod" manual describes the usage
of comma separated value lists.

It is *STRONGLY RECOMMENDED* that you supply "io=" instead of autoprobing.
If an "io=" argument is not supplied, then the ISA drivers will complain
about autoprobing being not recommended, and begrudgingly autoprobe for
a *SINGLE CARD ONLY* -- if you want to use multiple cards you *have* to 
supply an "io=0xNNN,0xQQQ,..." argument.
Therefore, I'm not certain, but it would be worth the experiment: io=0xXXX,0xYYY and irq=X,Y parameters (where these X's and Y's represent the values for each card respectively) should allow you to make it honor two cards explicitly rather than autoprobing them. If you succeed at that, try swapping card "X" and card "Y" in the settings and see if they switch places in the ethN ring. And in any case you should be able to get the right values for these from your logs, because you said you have the system detecting all 3 cards.
If they were really ISA cards with plug-n-play and/or jumpers, the isapnptools would be the next place I'd look.
I took the lazy route; I have a tulip and a 3com card in my dual ethernet system. With it that way, I can even tell the system to not even automatically bring these interfaces up, and explicitly bind the given drivers into the pre-up and post-down, at least on debian. In SuSE I have it mentioned in modules.conf:
alias eth0 3c59x
alias eth1 tulip


This page edited and maintained by the Editors of Linux Gazette Copyright © 2001
Published in issue 62 of Linux Gazette February 2001
HTML script maintained by Heather Stern of Starshine Technical Services, https://www.starshine.org/


[ Answer Guy Current Index ] greetings   1   2   3   4   5   6   7 [ Index of Past Answers ]