eth0/eth1 identity crisis on PB G4

Stefan Bruda yellowdog-general@lists.terrasoftsolutions.com
Tue Aug 12 18:44:01 2003


At 12:03 -0700 on 2003-8-12 John M. Wright wrote:
 >
 > Since I have returned, the AirPort has almost always showed up as
 > eth0, with the internal ethernet as eth1, although occasionally it
 > has reverted to the original designation.

That's quite normal, Ethernet interfaces are assigned in the order the
corresponding modules are loaded.  It also happened to me (wireless
network at home, wired at school).  Here is what I did to fix the
thing: I wrote small scripts for bringing each interface up and down.
In the "up" scripts, I use /sbin/nameif to reassign the interfaces.
The trick is that one cannot assign, say, eth0 if it is assigned
already, so you have to make sure that you unload all the pertinent
modules before (airport, orinoco, and hermes for wireless; sungem for
wired Ethernet on the Tibook).  Once all the interfaces are
unallocated, you could do:

/sbin/modprobe sungem
/sbin/nameif eth0 xx:xx:xx:xx:xx:xx

to always bring the wired network as eth0, where xx:xx:xx:xx:xx:xx is
the MAC address of your card (obtainable with /sbin/ifconfig eth0).
Similarly, to bind the Airport network to eth1 you do

/sbin/modprobe airport
/sbin/nameif eth1 yy:yy:yy:yy:yy:yy

again with yy:yy:yy:yy:yy:yy the MAC address of your Airport card.

The "down" scripts do an ifconfig ethX down and are also careful to do
rmmod on all the no longer needed modules.  This is probably
unnecessary, but does not cost anything either.

I should mention that I have compiled all the network support as
modules (so that I can load everything manually), which I believe to
be the case with precompiled kernels too.  It is also the case that I
do not bring any network interface up (except lo) upon startup.

You guys of course like GUIs and stuff, so the above solution may not
be pallatable to many.  You can then try to preload all the modules in
the order you want them to (i.e., sungem before airport and family) no
matter whether you use them or not.  To accomplish this, a line like
the following in your /etc/modules.conf will probably do the trick:

pre-install airport   /sbin/modprobe sungem

No matter what, you should then have sungem on eth0 and airport on
eth1 (indeed, assume that the system needs sungem first; that's fine,
it will go to eth0 by default; assume on the other hand that airport
is loaded by the system first; that's also fine, because sungem is
loaded by the pre-install statement before airport and thus gets
eth0).

Hope this helps,
Stefan


-- 
If it was so, it might be; and if it were so, it would be; but as
it isn't, it ain't. That's logic.
    --Lewis Carroll, Through the Looking-Glass