From: junk@maild.mine.nu Date: Tue, 11 Jan 2005 10:02:32 +0000 Subject: [LARTC] How to balance OUTBOUND traffic by packet if.. Message-Id: <1275.192.168.1.2.1105437752@maild.mine.nu> List-Id: References: <1383.192.168.1.2.1105108845@maild.mine.nu> In-Reply-To: <1383.192.168.1.2.1105108845@maild.mine.nu> MIME-Version: 1.0 Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: quoted-printable To: lartc@vger.kernel.org Hey thanks for replying , i got this from ethereal ..: tethereal -i ppp0 Capturing on ppp0 0.000000 80.178.69.24 -> 67.15.162.64 TCP 31604 > 53880 [ACK] Seq=3D0 Ack=3D0 WinV80 Len=1360 0.201730 80.178.69.24 -> 67.15.162.64 TCP [TCP Previous segment lost] 31604 > 53880 [ACK] Seq'20 Ack=3D0 WinV80 Len=1360 0.301142 80.178.69.24 -> 67.15.162.64 TCP [TCP Previous segment lost] 31604 > 53880 [PSH, ACK] SeqT40 Ack=3D0 WinV80 Len=1360 0.417813 80.178.69.24 -> 67.15.162.64 TCP [TCP Previous segment lost] 31604 > 53880 [ACK] Seq=8160 Ack=3D0 WinV80 Len=1360 0.516307 80.178.69.24 -> 67.15.162.64 TCP [TCP Previous segment lost] 31604 > 53880 [ACK] Seq=10880 Ack=3D0 WinV80 Len=1360 0.599234 80.178.69.24 -> 67.15.162.64 TCP [TCP Previous segment lost] 31604 > 53880 [ACK] Seq=13600 Ack=3D0 WinV80 Len=1360 0.647668 80.178.69.24 -> 67.15.162.64 TCP [TCP Previous segment lost] 31604 > 53880 [ACK] Seq=16320 Ack=3D0 WinV80 Len=1360 0.699314 80.178.69.24 -> 67.15.162.64 TCP [TCP Previous segment lost] .... tethereal -i ppp1 Capturing on ppp1 0.000000 67.15.162.64 -> 80.178.69.24 TCP 53880 > 31604 [ACK] Seq=3D0 Ack=3D0 WinD880 Len=3D0 SLE114001847 SRE114003207 SLE113999127 SRE114000487 SLE113996407 SRE113997767 SLE113993687 SRE113995047 0.008278 80.178.69.24 -> 67.15.162.64 TCP [TCP Previous segment lost] 31604 > 53880 [PSH, ACK] SeqC520 Ack=3D0 WinV80 Len=1360 0.014025 67.15.162.64 -> 80.178.69.24 TCP [TCP Dup ACK 1#1] 53880 > 31604 [ACK] Seq=3D0 Ack=3D0 WinF240 Len=3D0 SLE114004567 SRE114005927 SLE114001847 SRE114003207 SLE113999127 SRE114000487 SLE113996407 SRE113997767 0.091375 67.15.162.64 -> 80.178.69.24 TCP [TCP Dup ACK 1#2] 53880 > 31604 [ACK] Seq=3D0 Ack=3D0 WinF240 Len=3D0 SLE114007287 SRE114008647 SLE114004567 SRE114005927 SLE114001847 SRE114003207 SLE113999127 SRE114000487 0.098127 67.15.162.64 -> 80.178.69.24 TCP 53880 > 31604 [ACK] Seq=3D0 Ack'20 WinC520 Len=3D0 SLE114007287 SRE114008647 SLE114004567 SRE114005927 SLE114001847 SRE114003207 SLE113999127 SRE114000487 0.175701 67.15.162.64 -> 80.178.69.24 TCP [TCP Dup ACK 5#1] 53880 > 31604 [ACK] Seq=3D0 Ack'20 WinD880 Len=3D0 SLE114010007 SRE114011367 SLE114007287 SRE114008647 SLE114004567 SRE114005927 SLE114001847 SRE114003207 0.175892 80.178.69.24 -> 67.15.162.64 TCP [TCP Previous segment lost] 31604 > 53880 [ACK] SeqF240 Ack=3D0 WinV80 Len=1360 ..... Combine nth match with ROUTE target and you will get it. ip ro re default dev ppp0 iptables -A POSTROUTING -t mangle -o ppp+ -m nth --every 2 --packet 0 -j ROUTE --oif ppp0 iptables -A POSTROUTING -t mangle -o ppp+ -m nth --every 2 --packet 1 -j ROUTE --oif ppp1 iptables -A POSTROUTING -t nat -o ppp+ -j SNAT --to $ppp0_ip_addr I just guess that it'll work, I don't have IP spoofing enabled lines to test I am still looking for a solution to this problem....... > junk@maild.mine.nu wrote: >> Hi, >> Yes i did give this a try a couple of times before with no success >> >> /sbin/iptables -I OUTPUT -m nth --every 2 --packet 1 -t mangle -j MARK >> --set-mark 0x2 >> /sbin/iptables -I OUTPUT -m nth --every 2 --packet 0 -t mangle -j MARK >> --set-mark 0x1 >> >> ip rule : >> 0: from all lookup local >> 201: from all fwmark 0x2 lookup 202 >> 201: from all fwmark 0x1 lookup 201 >> 32766: from all lookup main >> ip route show table 202 >> default via 212.199.28.244 dev ppp1 proto static src 80.178.89.120 ip route show table 201 >> default via 212.199.26.111 dev ppp0 proto static src 84.94.148.214 ip route show table main >> 212.199.26.111 dev ppp0 proto kernel scope link src 84.94.148.214 212.199.28.244 dev ppp1 proto kernel scope link src 80.178.89.120 default proto static equalize >> nexthop via 212.199.26.111 dev ppp0 weight 1 >> nexthop via 212.199.28.244 dev ppp1 weight 1 > > > > I must admit I am more into tc than ip so I've never tried it. > > My guess is that you need to get rid of equalize/weights as these load balance per connection and the routes get cached. > > Andy. > > how to use iproute/iptables to balance by packet OUTBOUND traffic between 2 PPP (pptp cable modem and pppoe adsl modem) links to the same ISP . also by using the fact that the ISP dosen't filter source IP address - meaning i can use either PPP's link assigned IP address as the source IP in the ip header.., it works for both devices.., what i want to achive is : when uploading a large file , i could use both devices to shoot data but bound only to one source IP. Naturally i could expect all data to go back through the device with that corresponding IP , atleast that is what happens according to ethereal _______________________________________________ LARTC mailing list / LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/