From: "Lists @ Aptedtech" Date: Thu, 25 Mar 2004 01:22:39 +0000 Subject: RE: [LARTC] multipath routing Message-Id: MIME-Version: 1 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0002_01C411BC.39C6A4E0" List-Id: References: In-Reply-To: To: lartc@vger.kernel.org This is a multi-part message in MIME format. ------=_NextPart_000_0002_01C411BC.39C6A4E0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit I have a private lan that is connected to the world via 3 dsl lines. I put up a linux box that handles all the dsl lines, lan gateway and all is working well...until...one of the dsl lines goes down. My routing table is: x.x.x.x dev ppp0 proto kernel scope link src x.x.x.x x.x.x.x dev ppp1 proto kernel scope link src x.x.x.x x.x.x.x dev ppp2 proto kernel scope link src x.x.x.x 192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.1 255.255.255.0/24 dev eth0 scope link 169.254.0.0/16 dev eth0 scope link 127.0.0.0/8 dev lo scope link default equalize nexthop via x.x.x.x dev ppp0 weight 1 nexthop via x.x.x.x dev ppp1 weight 1 nexthop via x.x.x.x dev ppp2 weight 1 When one of the dsl lines has trouble (temporarily looses sync, etc), the kernel takes the entire default route out until the line comes back up. When the line comes up, it puts a single default route back in instead of the multipath route. If I can make it so the multipath route is maintained even when one of the dsl lines goes down, that would be great. Is there a way to have just one of the hops removed from the default multipath while the line is down and then reinserted back in as a hop in the multipath route? Thanks for any input. -Chris Do you have the stateful firewall settings in your script? According to nano.txt http://www.ssi.bg/~ja/nano.txt "At least for netfilter (not sure for ipfwadm/ipchains), the firewall must be stateful. This can be done by: iptables -t filter -N keep_state iptables -t filter -A keep_state -m state --state RELATED,ESTABLISHED \ -j ACCEPT iptables -t filter -A keep_state -j RETURN iptables -t nat -N keep_state iptables -t nat -A keep_state -m state --state RELATED,ESTABLISHED \ -j ACCEPT iptables -t nat -A keep_state -j RETURN and calling this at the beginning of the script: iptables -t nat -A PREROUTING -j keep_state iptables -t nat -A POSTROUTING -j keep_state iptables -t nat -A OUTPUT -j keep_state iptables -t filter -A INPUT -j keep_state iptables -t filter -A FORWARD -j keep_state iptables -t filter -A OUTPUT -j keep_state " /sbin/iptables-save # Generated by iptables-save v1.2.7a on Wed Mar 24 15:54:00 2004 *nat :PREROUTING ACCEPT [9983:812849] :POSTROUTING ACCEPT [0:0] :OUTPUT ACCEPT [3:174] :keep_state - [0:0] -A PREROUTING -j keep_state -A POSTROUTING -o ppp+ -j MASQUERADE -A POSTROUTING -j keep_state -A OUTPUT -j keep_state -A keep_state -m state --state RELATED,ESTABLISHED -j ACCEPT -A keep_state -j RETURN COMMIT # Completed on Wed Mar 24 15:54:00 2004 # Generated by iptables-save v1.2.7a on Wed Mar 24 15:54:00 2004 *filter :INPUT ACCEPT [1020:161876] :FORWARD DROP [0:0] :OUTPUT ACCEPT [425:33288] :keep_state - [0:0] -A INPUT -i lo -m state --state NEW,ESTABLISHED -j ACCEPT -A INPUT -i ppp+ -m state --state INVALID -j DROP -A INPUT -i ppp+ -m state --state ESTABLISHED -j ACCEPT -A INPUT -i ppp+ -p tcp -j DROP -A INPUT -i ppp+ -p udp -j DROP -A INPUT -i ppp+ -p icmp -j DROP -A INPUT -j keep_state -A FORWARD -i ppp+ -o eth+ -m state --state RELATED,ESTABLISHED -j ACCEPT -A FORWARD -i eth+ -o ppp+ -j ACCEPT -A FORWARD -j keep_state -A OUTPUT -o lo -m state --state NEW,ESTABLISHED -j ACCEPT -A OUTPUT -o ppp+ -m state --state NEW,ESTABLISHED -j ACCEPT -A OUTPUT -j keep_state -A keep_state -m state --state RELATED,ESTABLISHED -j ACCEPT -A keep_state -j RETURN COMMIT # Completed on Wed Mar 24 15:54:00 2004 The link you reference (http://www.ssi.bg/~ja/nano.txt) suggests several patches to be applied to the kernel for the routing described to be possible. I would like to do this, but it is a company box and they want a "standard" installation which basically means no patching for me. The box is running the most up to date kernel for a RedHat 9.0 install. Thanks for any input. -Chris ------=_NextPart_000_0002_01C411BC.39C6A4E0 Content-Type: text/html; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable
<snip>
I have a private lan that is connected to the world via 3 = dsl lines.=20  I put
up a linux box that handles all the dsl lines, lan = gateway and=20 all is
working well...until...one of the dsl lines goes down. =  My=20 routing table is:

x.x.x.x dev ppp0  proto kernel  scope = link=20  src x.x.x.x
x.x.x.x dev ppp1  proto kernel  scope = link=20  src x.x.x.x
x.x.x.x dev ppp2  proto kernel  scope = link=20  src x.x.x.x
192.168.1.0/24 dev eth0  proto kernel =  scope link=20  src 192.168.1.1
255.255.255.0/24 dev eth0  scope=20 link
169.254.0.0/16 dev eth0  scope link
127.0.0.0/8 dev lo=20  scope link
default equalize
      =  nexthop via=20 x.x.x.x  dev ppp0 weight 1
       nexthop = via=20 x.x.x.x  dev ppp1 weight 1
       nexthop = via=20 x.x.x.x  dev ppp2 weight 1

When one of the dsl lines has = trouble=20 (temporarily looses sync, etc), the
kernel takes the entire default = route out=20 until the line comes back up.
When the line comes up, it puts a = single=20 default route back in instead of
the multipath route.  If I can = make it=20 so the multipath route is maintained
even when one of the dsl lines = goes=20 down, that would be great.  Is there a
way to have just one of = the hops=20 removed from the default multipath while
the line is down and then = reinserted=20 back in as a hop in the multipath
route?  Thanks for any=20 input.

-Chris
</snip>


Do you have the stateful firewall settings in your = script?=20

According to nano.txt =
http://www.ssi.bg/~ja/nano.txt =

"At least for netfilter (not sure for = ipfwadm/ipchains), the=20 firewall
must be stateful. This can be done by:

    =  =20           iptables -t filter -N = keep_state
 =20               iptables -t filter -A=20 keep_state -m state --state RELATED,ESTABLISHED \
    =    =20                     =  =20    -j ACCEPT
            =  =20   iptables -t filter -A keep_state -j RETURN

    =  =20           iptables -t nat -N = keep_state
 =20               iptables -t nat -A = keep_state=20 -m state --state RELATED,ESTABLISHED \
        =  =20                     =  =20  -j ACCEPT
              =  =20 iptables -t nat -A keep_state -j RETURN

and calling this at the = beginning=20 of the script:

              =  =20 iptables -t nat -A PREROUTING -j keep_state
      =  =20         iptables -t nat -A POSTROUTING -j=20 keep_state
                = iptables=20 -t nat -A OUTPUT -j keep_state
          =  =20     iptables -t filter -A INPUT -j keep_state
    =  =20           iptables -t filter -A FORWARD -j=20 keep_state
                = iptables=20 -t filter -A OUTPUT -j keep_state
" 
 
 
/sbin/iptables-save
 
# Generated by iptables-save v1.2.7a on Wed Mar = 24 15:54:00=20 2004
*nat
:PREROUTING ACCEPT [9983:812849]
:POSTROUTING ACCEPT=20 [0:0]
:OUTPUT ACCEPT [3:174]
:keep_state - [0:0]
-A PREROUTING = -j=20 keep_state
-A POSTROUTING -o ppp+ -j MASQUERADE
-A POSTROUTING = -j=20 keep_state
-A OUTPUT -j keep_state
-A keep_state -m state = --state=20 RELATED,ESTABLISHED -j ACCEPT
-A keep_state -j RETURN =
COMMIT
#=20 Completed on Wed Mar 24 15:54:00 2004
# Generated by iptables-save = v1.2.7a on=20 Wed Mar 24 15:54:00 2004
*filter
:INPUT ACCEPT = [1020:161876]
:FORWARD=20 DROP [0:0]
:OUTPUT ACCEPT [425:33288]
:keep_state - [0:0]
-A = INPUT -i=20 lo -m state --state NEW,ESTABLISHED -j ACCEPT
-A INPUT -i ppp+ -m = state=20 --state INVALID -j DROP
-A INPUT -i ppp+ -m state --state = ESTABLISHED -j=20 ACCEPT
-A INPUT -i ppp+ -p tcp -j DROP
-A INPUT -i ppp+ -p udp = -j DROP=20
-A INPUT -i ppp+ -p icmp -j DROP
-A INPUT -j keep_state
-A = FORWARD=20 -i ppp+ -o eth+ -m state --state RELATED,ESTABLISHED -j ACCEPT
-A = FORWARD -i=20 eth+ -o ppp+ -j ACCEPT
-A FORWARD -j keep_state
-A OUTPUT -o lo = -m state=20 --state NEW,ESTABLISHED -j ACCEPT
-A OUTPUT -o ppp+ -m state --state = NEW,ESTABLISHED -j ACCEPT
-A OUTPUT -j keep_state
-A keep_state = -m state=20 --state RELATED,ESTABLISHED -j ACCEPT
-A keep_state -j RETURN=20
COMMIT
# Completed on Wed Mar 24 15:54:00=20 2004
 
 
The=20 link you reference (http://www.ssi.bg/~ja/nano.txt) suggests several patches = to be=20 applied to the kernel for the routing described to be possible.  I = would=20 like to do this, but it is a company box and they want a "standard" = installation=20 which basically means no patching for me.  The box is running the = most up=20 to date kernel for a RedHat 9.0 install.  Thanks for any=20 input.
 
-Chris
= ------=_NextPart_000_0002_01C411BC.39C6A4E0-- _______________________________________________ LARTC mailing list / LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/