Re: 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]

 



junk@xxxxxxxxxxxxx wrote:
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

Quick copy n past of a reply I gave recently.

Another way you could look into is doing it at IP level using the
netfilter patch Nth. You could just round robin packets over the links -
not as nice as multilink as packet size isn't accounted for, but may be
OK in practise.

Below is the help for it - You may not need to do the NAT but AIUI you
could use it to mark and then route using the marks.

Andy.

Author: Fabrice MARIE <fabrice@xxxxxxxxxxxxx>
Status: Works For Me.

This option adds CONFIG_IP_NF_MATCH_NTH, which supplies a match
module that will allow you to match every Nth packet encountered.
By default there are 16 different counters that can be used.

This match functions in one of two ways
1) Match ever Nth packet, and only the Nth packet.
    example:
     iptables -t mangle -A PREROUTING -m nth --every 10 -j DROP
    This rule will drop every 10th packet.
2) Unique rule for every packet.  This is an easy and quick
    method to produce load-balancing for both inbound and outbound.
    example:
     iptables -t nat -A POSTROUTING -o eth0 -m nth --counter 7 \
              --every 3 --packet 0 -j SNAT --to-source 10.0.0.5
     iptables -t nat -A POSTROUTING -o eth0 -m nth --counter 7 \
              --every 3 --packet 1 -j SNAT --to-source 10.0.0.6
     iptables -t nat -A POSTROUTING -o eth0 -m nth --counter 7 \
              --every 3 --packet 2 -j SNAT --to-source 10.0.0.7
    This example evenly splits connections between the three SNAT
    addresses.

    By using the mangle table and iproute2, you can setup complex
    load-balanced routing.  There's lot of other uses.  Be creative!

Suppported options are:
    --every     Nth         Match every Nth packet
   [--counter]  num         Use counter 0-15 (default:0)
   [--start]    num         Initialize the counter at the number 'num'
                            instead of 0. Must be between 0 and Nth-1
   [--packet]   num         Match on 'num' packet. Must be between 0
                            and Nth-1.
                            If --packet is used for a counter than
                            there must be Nth number of --packet
                            rules, covering all values between 0 and
                            Nth-1 inclusively.


Andy.


_______________________________________________ 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