How to balance OUTBOUND traffic by packet if..

Linux Advanced Routing and Traffic Control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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=0
Ack=0 Win=5680 Len=1360
  0.201730 80.178.69.24 -> 67.15.162.64 TCP [TCP Previous segment lost]
31604 > 53880 [ACK] Seq=2720 Ack=0 Win=5680 Len=1360
  0.301142 80.178.69.24 -> 67.15.162.64 TCP [TCP Previous segment lost]
31604 > 53880 [PSH, ACK] Seq=5440 Ack=0 Win=5680 Len=1360
  0.417813 80.178.69.24 -> 67.15.162.64 TCP [TCP Previous segment lost]
31604 > 53880 [ACK] Seq=8160 Ack=0 Win=5680 Len=1360
  0.516307 80.178.69.24 -> 67.15.162.64 TCP [TCP Previous segment lost]
31604 > 53880 [ACK] Seq=10880 Ack=0 Win=5680 Len=1360
  0.599234 80.178.69.24 -> 67.15.162.64 TCP [TCP Previous segment lost]
31604 > 53880 [ACK] Seq=13600 Ack=0 Win=5680 Len=1360
  0.647668 80.178.69.24 -> 67.15.162.64 TCP [TCP Previous segment lost]
31604 > 53880 [ACK] Seq=16320 Ack=0 Win=5680 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=0
Ack=0 Win=44880 Len=0 SLE=3114001847 SRE=3114003207 SLE=3113999127
SRE=3114000487 SLE=3113996407 SRE=3113997767 SLE=3113993687
SRE=3113995047
  0.008278 80.178.69.24 -> 67.15.162.64 TCP [TCP Previous segment lost]
31604 > 53880 [PSH, ACK] Seq=43520 Ack=0 Win=5680 Len=1360
  0.014025 67.15.162.64 -> 80.178.69.24 TCP [TCP Dup ACK 1#1] 53880 >
31604 [ACK] Seq=0 Ack=0 Win=46240 Len=0 SLE=3114004567 SRE=3114005927
SLE=3114001847 SRE=3114003207 SLE=3113999127 SRE=3114000487
SLE=3113996407 SRE=3113997767
  0.091375 67.15.162.64 -> 80.178.69.24 TCP [TCP Dup ACK 1#2] 53880 >
31604 [ACK] Seq=0 Ack=0 Win=46240 Len=0 SLE=3114007287 SRE=3114008647
SLE=3114004567 SRE=3114005927 SLE=3114001847 SRE=3114003207
SLE=3113999127 SRE=3114000487
  0.098127 67.15.162.64 -> 80.178.69.24 TCP 53880 > 31604 [ACK] Seq=0
Ack=2720 Win=43520 Len=0 SLE=3114007287 SRE=3114008647 SLE=3114004567
SRE=3114005927 SLE=3114001847 SRE=3114003207 SLE=3113999127
SRE=3114000487
  0.175701 67.15.162.64 -> 80.178.69.24 TCP [TCP Dup ACK 5#1] 53880 >
31604 [ACK] Seq=0 Ack=2720 Win=44880 Len=0 SLE=3114010007 SRE=3114011367
SLE=3114007287 SRE=3114008647 SLE=3114004567 SRE=3114005927
SLE=3114001847 SRE=3114003207
  0.175892 80.178.69.24 -> 67.15.162.64 TCP [TCP Previous segment lost]
31604 > 53880 [ACK] Seq=46240 Ack=0 Win=5680 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@xxxxxxxxxxxxx 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@xxxxxxxxxxxxxxx
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

[Index of Archives]     [LARTC Home Page]     [Netfilter]     [Netfilter Development]     [Network Development]     [Bugtraq]     [GCC Help]     [Yosemite News]     [Linux Kernel]     [Fedora Users]
  Powered by Linux