Re: Need help on NAT

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

 



hi Saeed
There is an iptables patch called "nth" which allows you to match every Nth
packet encountered. 
That includes load-balancing such as you desire like every 4 received packet, 
SNAT first to the ip of ISP1, the other three to the ip of ISP2.

i. e.:  iptables -t nat -A POSTROUTING -o eth0 -m nth --counter 7 \
             --every 4 --packet 0 -j SNAT --to-source $ISP1
        iptables -t nat -A POSTROUTING -o eth0 -m nth --counter 7 \
             --every 4 --packet 1 -j SNAT --to-source $ISP2
        iptables -t nat -A POSTROUTING -o eth0 -m nth --counter 7 \
             --every 4 --packet 2 -j SNAT --to-source $ISP2
        iptables -t nat -A POSTROUTING -o eth0 -m nth --counter 7 \
             --every 4 --packet 2 -j SNAT --to-source $ISP2

have a look at this
http://cvs.netfilter.org/patch-o-matic-ng/nth/help?rev=1.2

It is available in the netfilter patch-o-matic base repository

---
Fabian Hartmann

realdeal@xxxxxxxxxxxx
www.realdealz.ch


[Index of Archives]     [Linux Netfilter Development]     [Linux Kernel Networking Development]     [Netem]     [Berkeley Packet Filter]     [Linux Kernel Development]     [Advanced Routing & Traffice Control]     [Bugtraq]

  Powered by Linux