From: "Hans Middelhoek.nl" Date: Thu, 28 Jul 2005 16:07:30 +0000 Subject: [LARTC] multiple uplinks works on linux router but not on clients Message-Id: <001401c5938e$753ae400$8214a8c0@hanslt> MIME-Version: 1 Content-Type: multipart/mixed; boundary="===============0817834854==" List-Id: To: lartc@vger.kernel.org This is a multi-part message in MIME format. --===============0817834854== Content-Type: multipart/alternative; boundary="----=_NextPart_000_0011_01C5939F.389C07C0" This is a multi-part message in MIME format. ------=_NextPart_000_0011_01C5939F.389C07C0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hello, I'm trying to achieve the following. 2 ISP's and 1 LAN with failover. So, when 1 internet connection fails = the other need to take over. I'm aware of the restrictions. The current = sessions are lost. I did this before, one and a half year ago or something. But at that = router wasn't failover. Now i've read the nano howto and followed it. I'm using Debian with kernel 2.6.12-3 patched with Julian Anastasov's = routes patch. This integrated failover functionality. I need to say. It = works great on the machine itself. Everytime I start a traceroute = another link will be used. When I unplug an internet link, all of my = traceroutes uses the internet connections which are up. When I re-plug = the internet link my traceroutes will use the one again. This is how it needs to be, also for the connected pc's. But that's not = working. All traceroutes on client machine are going through the same = router: 192.168.20.1->192.168.32.1->internet I used following firewall rules, but that shouldn't be the problem: 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 iptables -t nat -A POSTROUTING -o eth1 -s 192.168.20.0/24 -j SNAT --to = 192.168.1.240 iptables -t nat -A POSTROUTING -o eth2 -s 192.168.20.0/24 -j SNAT --to = 10.0.0.240 iptables -t nat -A POSTROUTING -o eth3 -s 192.168.20.0/24 -j SNAT --to = 192.168.32.240 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 It looks like the problem comes from my multi route table 222. When I = change the order of the devices in the multiroute rule all of my = traceroutes on the clients are using the last nexthop via. I'm using = three eth's as external interfaces and always the last one in my = multihop route will be used by my workstations. Setup: ip rule ls 0: from all lookup local 50: from all lookup main 201: from 192.168.1.0/24 lookup 201 202: from 10.0.0.0/24 lookup 202 203: from 192.168.32.0/24 lookup 203 222: from all lookup 222 32766: from all lookup main 32767: from all lookup default ip ro s t 222 default proto static nexthop via 192.168.1.1 dev eth1 weight 1 nexthop via 10.0.0.138 dev eth2 weight 1 nexthop via 192.168.32.1 dev eth3 weight 1 ip ro s t 201 default via 192.168.1.1 dev eth1 proto static src 192.168.1.240 prohibit default proto static metric 1 ip ro s t 202 default via 10.0.0.138 dev eth2 proto static src 10.0.0.240 prohibit default proto static metric 1 ip ro s t 203 default via 192.168.32.1 dev eth3 proto static src 192.168.32.240 prohibit default proto static metric 1 Well, I think you have all the information. What I want to do is simply = routing on multiple interfaces. No queue based routing or something. = Linux may just choose which route is going to be used. Thanks for your help in advance. Kind regards, Hans Middelhoek Netherlands ------=_NextPart_000_0011_01C5939F.389C07C0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hello,
I'm trying to achieve the = following.
2 ISP's and 1 LAN with failover. So, = when 1=20 internet connection fails the other need to take over. I'm aware of the=20 restrictions. The current sessions are lost.
I did this before, one and a half year = ago or=20 something. But at that router wasn't failover. Now i've read the nano = howto and=20 followed it.
 
I'm using Debian with kernel 2.6.12-3 = patched with=20 Julian Anastasov's routes patch. This integrated failover functionality. = I need=20 to say. It works great on the machine itself. Everytime I start a = traceroute=20 another link will be used. When I unplug an internet link, all of my = traceroutes=20 uses the internet connections which are up. When I re-plug the internet = link my=20 traceroutes will use the one again.
This is how it needs to be, also for = the connected=20 pc's. But that's not working. All traceroutes on client machine are = going=20 through the same router: = 192.168.20.1->192.168.32.1->internet
 
I used following firewall rules, but=20 that shouldn't be the problem:
iptables -t filter -N = keep_state
iptables -t=20 filter -A keep_state -m state --state RELATED,ESTABLISHED -j = ACCEPT
iptables=20 -t filter -A keep_state -j RETURN
 
iptables -t nat -N = keep_state
iptables -t nat -A=20 keep_state -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -t = nat -A=20 keep_state -j RETURN
 
iptables -t nat -A POSTROUTING = -o eth1=20 -s 192.168.20.0/24 -j SNAT --to 192.168.1.240
iptables -t nat -A = POSTROUTING -o eth2 -s 192.168.20.0/24 -j SNAT --to=20 10.0.0.240
iptables -t nat -A POSTROUTING -o eth3 -s 192.168.20.0/24 = -j SNAT=20 --to 192.168.32.240
 
iptables -t nat -A PREROUTING -j=20 keep_state
iptables -t nat -A POSTROUTING -j keep_state
iptables = -t nat -A=20 OUTPUT -j keep_state
iptables -t filter -A INPUT -j = keep_state
iptables -t=20 filter -A FORWARD -j keep_state
iptables -t filter -A OUTPUT -j=20 keep_state
 
It looks like the problem comes from my = multi route=20 table 222. When I change the order of the devices in the multiroute rule = all of=20 my traceroutes on the clients are using the last nexthop via. I'm using = three=20 eth's as external interfaces and always the last one in my multihop = route will=20 be used by my workstations.
Setup:
ip rule = ls
0:      from=20 all lookup local
50:     from all lookup=20 main
201:    from 192.168.1.0/24 lookup=20 201
202:    from 10.0.0.0/24 lookup=20 202
203:    from 192.168.32.0/24 lookup=20 203
222:    from all lookup 222
32766:  from = all=20 lookup main
32767:  from all lookup default
 
 ip ro s t 222
default  = proto=20 static
        nexthop via=20 192.168.1.1  dev eth1 weight=20 1
        nexthop via = 10.0.0.138  dev=20 eth2 weight 1
        nexthop=20 via 192.168.32.1  dev eth3 weight 1
 
ip ro s t 201
default via = 192.168.1.1 dev=20 eth1  proto static  src 192.168.1.240
prohibit = default  proto=20 static  metric 1
 
ip ro s t 202
default via 10.0.0.138 = dev=20 eth2  proto static  src 10.0.0.240
prohibit default  = proto=20 static  metric 1
 
ip ro s t 203
default via = 192.168.32.1 dev=20 eth3  proto static  src 192.168.32.240
prohibit = default  proto=20 static  metric 1
 
Well, I think you have all the = information. What I=20 want to do is simply routing on multiple interfaces. No queue based = routing or=20 something. Linux may just choose which route is going to be = used.
 
Thanks for your help in = advance.
Kind regards,
Hans Middelhoek
Netherlands
------=_NextPart_000_0011_01C5939F.389C07C0-- --===============0817834854== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ LARTC mailing list LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc --===============0817834854==--