From: Pascal Hambourg <pascal.mail@plouf.fr.eu.org>
To: Mail List - Netfilter <netfilter@vger.kernel.org>
Subject: Re: Altering firewall rules to enable NAT Reflection
Date: Sat, 08 Nov 2008 12:21:13 +0100 [thread overview]
Message-ID: <49157629.2020104@plouf.fr.eu.org> (raw)
In-Reply-To: <49149060.70100@riverviewtech.net>
Hello,
Grant Taylor a écrit :
>
> What you want to do is have a very similar rule to DNAT any outbound
> traffic (coming in the internal interface to go out the external
> interface) that is destined to the IP and / or port of the service
> DNATed over to the internal IP / port as well. I.e.
>
> iptables -t nat -A PREROUTING -i eth1 -d $PUBLIC_IP -p tcp --dport
> 443 -j DNAT --to-destination $PRIVATE_IP
And make sure that traffic forwarded from eth1 to eth1 is ACCEPTed in
the filter/FORWARD chain.
> Now to prevent what I call a "TCP Triangle" you will need to SNAT the
> internal traffic that is being redirected back to the $PRIVATE_IP so
> that replies pass back through the router and back to the original
> client rather than the $PRIVATE_IP replying directly to the original
> client. (See 'Julian's TCP Triangle' page
> "http://jengelh.medozas.de/images/dnat-mistake.png" for a diagram.)
>
> iptables -t nat -A POSTROUTING -o eth1 -s $PRIVATE_LAN/$NM -d
> $PRIVATE_IP -j MASQUERADE
>
> Note: You can use either the MASQUERADE or SNAT target depending on
> your preferences or what ever is compiled in to your kernel. I chose
> MASQUERADE so I did not have to take your routers internal IP in to
> account in the rule(s) above.
Note both SNAT and MASQUERADE hide the real source address from the
server, which may be annoying for logging or access control purposes.
Source NAT is not required to avoid the "routing triangle" if the server
itself can route the return traffic to the NAT router. This can be
achieved with advanced routing on Linux. Alternatively, the router may
use the NETMAP target instead of SNAT or MASQUERADE to do a 1-to-1
mapping of the source address range into another range, so the original
source address can be retrieved.
next prev parent reply other threads:[~2008-11-08 11:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-06 23:25 Altering firewall rules to enable NAT Reflection Simon
2008-11-07 19:00 ` Grant Taylor
2008-11-08 11:21 ` Pascal Hambourg [this message]
2008-11-08 18:52 ` Grant Taylor
2008-11-09 23:14 ` Simon
2008-11-10 1:26 ` Grant Taylor
2008-11-10 3:06 ` Simon
2008-11-10 4:39 ` Grant Taylor
2008-11-13 1:30 ` Simon
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=49157629.2020104@plouf.fr.eu.org \
--to=pascal.mail@plouf.fr.eu.org \
--cc=netfilter@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.