From: Erich Weiler <weiler@soe.ucsc.edu>
To: Pascal Hambourg <pascal.mail@plouf.fr.eu.org>
Cc: netfilter@vger.kernel.org
Subject: Re: IPTABLES port forwarding woes
Date: Fri, 30 May 2008 14:06:19 -0700 [thread overview]
Message-ID: <48406C4B.9070002@soe.ucsc.edu> (raw)
In-Reply-To: <48405164.3000706@plouf.fr.eu.org>
> No, the connection tracking takes care of all this. The NAT operations
> applied by iptables rules to the first packet creating the connection
> are recorded and applied to subsequent packets in the same direction,
> while the inverse operations are applied to reply packets in the
> opposite direction.
Excellent, it works just fine now! Here's my final iptables file, just
in case it would help anyone in the list:
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [66:7948]
-A FORWARD -d 10.1.3.133 -i eth0 -o eth1 -p tcp -m tcp --dport 22 -m
state --state NEW -j ACCEPT
-A FORWARD -o eth0 -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -i eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
COMMIT
*nat
:PREROUTING ACCEPT [451:32699]
:POSTROUTING ACCEPT [2:236]
:OUTPUT ACCEPT [2:236]
-A PREROUTING -d 120.1.1.10 -i eth0 -p tcp -m tcp --dport 2222 -j DNAT
--to-destination 10.1.3.133:22
-A POSTROUTING -s 10.1.3.133 -o eth0 -j SNAT --to-source 120.1.1.10
COMMIT
-A POSTROUTING -o eth1 -p tcp --dport 22 -d 10.1.3.133 -j SNAT --to
10.1.1.50
Thanks again!
-erich
next prev parent reply other threads:[~2008-05-30 21:06 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-30 14:02 IPTABLES port forwarding woes Erich Weiler
2008-05-30 14:42 ` Pascal Hambourg
2008-05-30 15:17 ` Erich Weiler
2008-05-30 19:11 ` Pascal Hambourg
2008-05-30 21:06 ` Erich Weiler [this message]
-- strict thread matches above, loose matches on Subject: below --
2008-05-30 13:24 Erich Weiler
2008-05-30 13:53 ` Pascal Hambourg
2008-05-30 13:15 Erich Weiler
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=48406C4B.9070002@soe.ucsc.edu \
--to=weiler@soe.ucsc.edu \
--cc=netfilter@vger.kernel.org \
--cc=pascal.mail@plouf.fr.eu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox