--- Begin Message ---
- To: Lennart Sorensen <lsorense@csclub.uwaterloo.ca>
- Cc: debian-arm <debian-arm@lists.debian.org>
- Subject: Re: nslu2: two devices: one by default
- From: Xan <dxpublica@telefonica.net>
- Date: Fri, 01 Jan 2010 20:56:05 +0100
- Message-id: <4B3E5355.5040802@telefonica.net>
- In-reply-to: <20091210193826.GM760@caffeine.csclub.uwaterloo.ca>
- References: <052216CD-558B-4098-8A71-7A5A31D88989@mac.com> <4AEF36F8.5080304@telefonica.net> <20091102201857.GE29303@caffeine.csclub.uwaterloo.ca> <4AEF47EE.9000800@telefonica.net> <20091102230430.GH29303@caffeine.csclub.uwaterloo.ca> <4AF0249F.6090904@telefonica.net> <20091103152138.GJ29303@caffeine.csclub.uwaterloo.ca> <4B07DAC7.5010801@telefonica.net> <4B07F5BC.3050102@telefonica.net> <4B211BDC.8040804@telefonica.net> <20091210193826.GM760@caffeine.csclub.uwaterloo.ca>
Hi,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? Thanks, Xan. En/na Lennart Sorensen ha escrit:On Thu, Dec 10, 2009 at 05:03:40PM +0100, Xan wrote:Hi, I have now this route table: # route Kernel IP routing tableDestination Gateway Genmask Flags Metric Ref Use Ifacelocalnet * 255.255.0.0 U 0 0 0 eth0localnet * 255.255.0.0 U 0 0 0 wlan0 default 172.26.0.1 0.0.0.0 UG 0 0 0 wlan0default 172.26.0.1 0.0.0.0 UG 0 0 0 eth0 (with ip route I get: 172.26.0.0/16 dev eth0 proto kernel scope link src 172.26.0.2 172.26.0.0/16 dev wlan0 proto kernel scope link src 172.26.0.3 default via 172.26.0.1 dev wlan0 default via 172.26.0.1 dev eth0 ) and I want to get that: # route Kernel IP routing tableDestination Gateway Genmask Flags Metric Ref Use Ifacelocalnet * 255.255.0.0 U 0 0 0 eth0 default 172.26.0.1 0.0.0.0 UG 0 0 0 eth0 Can I get that with the following command? Please confirm: ip route del default via 172.26.0.1 dev wlan0 ip route del 172.26.0.1/16 dev wlan0 proto kernel scope link src 172.26.0.1andip route add 172.26.0.1/16 dev eth0 proto kernel scope link src 172.26.0.1 ip route add default via 172.26.0.1 dev eth0 ? Is it correct?Should work, or you could do: ip route replace 172.26.0.1/16 dev eth0 proto kernel scope link src 172.26.0.1 ip route replace default via 172.26.0.1 dev eth0 instead of del and add.
--- End Message ---