[ltp] eth0 or eth1 active ?

Richard Neill linux-thinkpad@linux-thinkpad.org
Tue, 31 Jan 2006 12:00:48 +0000


This is the same stupid problem of ethX not being permanently mapped to 
MAC addresses that seems to plague everyone from time to time. 
Basically, the kernel probes the ethernet devices in the "wrong" order 
with the motherboard ones last. Thus eth0 may already be snapped up 
before the kernel looks at the motherboard ethernet interface.

It doesn't help that all the network interfaces (ethernet,firewire,wifi 
etc except for ppp) are named eth*. I think that "eth" ought to imply 
"something you plug a cat5 cable into" !

The proper way to solve it is to name the interfaces with a udev rule.
http://www.reactivated.net/writing_udev_rules.html

However, there is an ugly hack. Force the relevant kernel module to be 
loaded before it probes anything. In my case, the ethernet module is 
eepro100. So, I add
	eepro100
to
	/etc/modprobe.preload

Voila: eepro100 is loaded before any hardware probing takes place, and 
so the first detected interface (eth0) is always the one on the motherboard.

Hope that helps,

Richard



Francois Maltey wrote:
> Hello,
> 
> When I use my thinkpad at home near a wifi router 
> 
> I often get the right solution :
> 1/     wifi link on eth1 active
> 2/ ethernet link on eth0 down 
> and all is perfect.
> 
> But sometimes the debian etch boot puts 
> 1/ ethernet link on eth0 active 
> 2/     wifi link on eth1 down
> and /etc/init.d/ntpdate service lock the boot for 1 or 2 minutes.
> 
> Then I shutdown ethernet link and wake-up wifi link in gnome network monitor.
> After I type always the same IP adress, gateway adress, and essid name.
> 
> My /etc/network/interfaces is :
> ---------------------------------------------------------
> auto lo
> iface lo inet loopback
> 
> auto eth1
> # The primary network interface
> iface eth1 inet static
> address 192.168.0.5
> netmask 255.255.255.0
> gateway 192.168.0.1
> wireless-essid Wireless
> 
> iface eth0 inet static
> address 192.168.0.15
> netmask 255.255.255.0
> gateway 192.168.0.1
> 
> --------------------------------------------------------
> The problem is the same when I remain or remove the eth0 lines.
> 
> How can I force the debian to use eth1 ?
> How can I force the system to forget the eth0 link ?
> 
> What is the route command which delete a complete iterface 
> and how can I add a gateway with route ?
> I don't understand the man page.
> 
> Thanks a lot for your help !
> 
> Francois

-- 
rn214@hermes.cam.ac.uk  **  http://www.richardneill.org
Richard Neill, Trinity College, Cambridge, CB21TQ, U.K.