[clug] asymmetric routing
tridge at samba.org
tridge at samba.org
Wed Aug 26 06:29:00 MDT 2009
Hi Chris,
I use asymmetic routing on my home server for similar reasons. I have
a primary ADSL link, but I also have a backup 3G USB modem connected
to the box (a cheap exetel $5/m account), and I want to be able to ssh
into my home system if the main ADSL link is down. Without asymmetic
routing that doesn't work as the server tries to send replies to the
ssh traffic out the bad ADSL link.
The solution I use is a script like this in /etc/ppp/ip-up.d/routes:
#!/bin/bash
# Called when a new interface comes up
IFACE="$1"
LOCALIP="$4"
REMOTEIP="$5"
ip rule add from "$LOCALIP/32" lookup SECONDARY
ip route add default via "$REMOTEIP" dev "$IFACE" table SECONDARY
ip route flush table cache
then I have this in /etc/iproute2/rt_tables:
1 PRIMARY
2 SECONDARY
The end result is that if I ssh into the IP of my 3G link, reply
packets come out via that link. All other traffic goes out the main
link. This means I have a backup way into my server should the primary
link be down.
I have a script which starts the PPP link over the 3G modem and keeps
it up. Each time it reconnects the above script fixes up the asymmetic
routing.
I know this isn't exactly what you asked for, but I thought it might
be close enough to be useful.
Cheers, Tridge
More information about the linux
mailing list