From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Saeed Zamani" Subject: RE: Need help on NAT Date: Tue, 10 Feb 2004 23:04:48 +0330 Sender: netfilter-admin@lists.netfilter.org Message-ID: <000001c3f00c$fb858050$3c23d9d5@Zamani> References: <1076414843.4028c97b900c7@www.realdealz.ch> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1076414843.4028c97b900c7@www.realdealz.ch> Errors-To: netfilter-admin@lists.netfilter.org List-Help: List-Post: List-Subscribe: , List-Id: List-Unsubscribe: , List-Archive: Content-Type: text/plain; charset="us-ascii" To: 'Fabian Hartmann' Cc: netfilter@lists.netfilter.org Thank you all. Excellent solutions. Saeed Zamani. -----Original Message----- From: Fabian Hartmann [mailto:realdeal@realdealz.ch] Sent: Tuesday, February 10, 2004 3:37 PM To: Saeed Zamani Cc: netfilter@lists.netfilter.org Subject: Re: Need help on NAT 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@realdealz.ch www.realdealz.ch