[ltp] WiFi on T42 (ifup eth1 no go, txpower is off)

morpheus linux-thinkpad@linux-thinkpad.org
Sat, 15 Jan 2005 17:43:43 -0500


On Sat, 2005-01-15 at 08:24 -0800, ogjunk-linuxtp@yahoo.com wrote:
> So I tried adding a new route/gateway for eth1 device (WiFi card):
> 
> # route add default gw 192.168.0.1 eth1
> 
> This gave me:
> 
> # route
> Kernel IP routing table
> Destination     Gateway         Genmask         Flags Metric Ref    Use
> Iface
> 192.168.0.0     *               255.255.255.0   U     0      0        0
> eth0
> 192.168.0.0     *               255.255.255.0   U     0      0        0
> eth1
> 169.254.0.0     *               255.255.0.0     U     0      0        0
> eth1
> default         192.168.0.1     0.0.0.0         UG    0      0        0
> eth1
> default         192.168.0.1     0.0.0.0         UG    0      0        0
> eth0
> 
Did you try # ping -I eth1 xxx.xxx.xxx.xxx

First, I would check out http://linux-ip.net/html/linux-ip.html#basic-
changing-default (scoll down to get table of contents).  This is a great
document that teaches you all about IP networking on Linux.

Your basic problem is that the packet can only go over one interface.
However, you have two routes defined as "default"...the "default" route
catches all destinations not previously caught by other routes, so there
is no way to decide which "default" route to use.
Linux decides by shaking a magic 8 ball...
Seriously, different implementations decide differently (first defined,
last defined, lowest IF number, etc.) but there is no way to know for
sure.  The one thing for sure is that when you define multiple routes
with the same destination (such as "default") ONLY ONE default gw will
be used, and the SAME one will be used every time.

There are several ways out of this situation:
First, you could use the "Metric" parameter to prioritize your default
routes:
# route add default gw 192.168.0.1 metric 1 eth1
# route add default gw 192.168.0.1 metric 2 eth0
This would give priority to eth1, and when eth1 is not available, would use eth0.

Next, you could just take down eth0, (I think ifdown also removes the
routes for you) and then all your packets would hit the default route
for eth1.

Or, you could leave both interfaces up and on the same subnet, and just
explicitly specify the interface to use in each application.  For
example, when you ping you could use:
# ping -I eth1 xxx.xxx.xxx.xxx
This would force the ping over eth1.  Most applications and commands
allow you to do this, but it seems pretty tedious for you.

You could use different subnets...but this doesn't seem to be an option
for you since your AP is on the same subnet as your wired LAN.

There are two more options, in the "advanced" category:
You could use "link aggregation".  This would treat BOTH eth0 and eth1
as a single "virtual interface" and send packets over both.
This is not trivial to set up, but information is available here:
http://linux-ip.net/html/ether-bonding.html
You could use iptables to "tag" your outbound traffic and then create
routing rules to select the interface based on the tags. This is
explained in:
http://linux-ip.net/html/adv-multi-internet.html

Let me know if you have questions getting this set up.

-m