Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Amos Jeffries <squid3@treenet.co.nz>
To: GMail Isaac Gonzalez <isaak.gonzalez@gmail.com>
Cc: "Gáspár Lajos" <swifty@freemail.hu>,
	"netfilter list" <netfilter@vger.kernel.org>
Subject: Re: POSTROUTING SNAT only reply packets
Date: Tue, 18 Jan 2011 00:14:23 +1300	[thread overview]
Message-ID: <4D34248F.6020408@treenet.co.nz> (raw)
In-Reply-To: <4D341F4C.3020002@gmail.com>

On 17/01/11 23:51, GMail Isaac Gonzalez wrote:
> Hi,
>
> I know that doing the NAT in the firewall will do the trick, but the
> problem is that the "firewall and webserver" and the load balancer are
> in differents networks, then the webserver replies only goes through the
> firewall, and not though the load balancer. On the other hand the
> loadbalancer isn't a Linux box, then I can't not modify anything about
> packets, moreover I can't do any kind of routing.


Slow down, read again Gáspár response. Think particularly carefully 
about what the SNAT lines are doing there.

I'm fairly sure the LB will be capable of it somehow. If not, you have a 
nice heater to sit your feet on in winter.

As a giant hack you could also do SNAT on the device(s) receiving 
packets from the LB such that the reply packets get routed back through 
the LB.

>
> El 17/01/11 11:38, Gáspár Lajos escribió:
>> Hi,
>>
>> You should do all of the NAT-ing ON THE LOAD BALANCER:
>>
>> iptables -t nat -A PREROUTING -j DNAT -p tcp --dport 80
>> --to-destination WEBSERVER1 (some load balancing options here)
>> iptables -t nat -A PREROUTING -j DNAT -p tcp --dport 80
>> --to-destination WEBSERVER2 (some load balancing options here)
>>
>> iptables -t nat -A POSTROUTING -j SNAT -p tcp --dport 80 -d WEBSERVER1
>> --to-source BALANCER_IP_ON_WEBSERVER1_NET
>> iptables -t nat -A POSTROUTING -j SNAT -p tcp --dport 80 -d WEBSERVER1
>> --to-source BALANCER_IP_ON_WEBSERVER2_NET
>>
>> But some other rules may be in effect....
>>
>> Swifty
>>

AYJ

  reply	other threads:[~2011-01-17 11:14 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-17 10:16 POSTROUTING SNAT only reply packets GMail Isaac Gonzalez
2011-01-17 10:38 ` Gáspár Lajos
2011-01-17 10:51   ` GMail Isaac Gonzalez
2011-01-17 11:14     ` Amos Jeffries [this message]
2011-01-17 10:55   ` Giles Coochey
2011-01-17 11:07     ` GMail Isaac Gonzalez
2011-01-17 11:36     ` Jan Engelhardt
2011-01-17 11:41       ` Giles Coochey
2011-01-17 11:57         ` GMail Isaac Gonzalez
2011-01-17 12:10           ` Jan Engelhardt
2011-01-17 23:07 ` Michael Vallaly
  -- strict thread matches above, loose matches on Subject: below --
2011-01-17 10:15 Isaac González

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D34248F.6020408@treenet.co.nz \
    --to=squid3@treenet.co.nz \
    --cc=isaak.gonzalez@gmail.com \
    --cc=netfilter@vger.kernel.org \
    --cc=swifty@freemail.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox