[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [Fwd: Re: nslu2: two devices: one by default]

En/na Lennart Sorensen ha escrit:
On Mon, Jan 04, 2010 at 09:23:56PM +0100, Xan wrote:
I have follow your comments and for now I wrote a python script [http://github.com/somenxavi/misc/blob/master/change-routing-script/cable-ini.py] that I run every minute in my system. It essentially see if ethernet cable is present. If it's nothing do. If it isn't (unplugged), then it modify the routing table (via ip route) for put wlan0 (instead eth0) as my prefered route device.

But it does not works: when I unplugged the cable, then the script does not modify the routing table (see the log of my system [http://github.com/somenxavi/misc/blob/master/change-routing-script/log.txt]).

Can you see it? How can I change the script for doing what I want?

Well your script probably only works if the state of the system at boot
is right.  That means you have to have both interfaces started I guess,
but you have to delete one of the routes since you have both configured
for the same subnet.

So at boot you probably have to do:

If link on eth0, delete route on wifi
else delete route on eth0

If you start out with routes on both, then the ip route replace can't
work that your script is using.

Based on a quick look at it I would expect the script to work, as long
as the starting state is proper.

Okay. Thanks Lennart. I will modify the script. And when all is right I will email you for notices...


Reply to: