From: "Taylor, Grant" <gtaylor@riverviewtech.net>
To: julien WICQUART <j.wicquart@newtech.fr>
Cc: netfilter@lists.netfilter.org
Subject: Re: SNAT and DNAT
Date: Wed, 27 Apr 2005 22:30:55 -0500 [thread overview]
Message-ID: <427058EF.8030102@riverviewtech.net> (raw)
In-Reply-To: <426E4DAC.30900@newtech.fr>
> Hi,
>
> i have a special situation.
>
> (INTERNET) ===== 210.210.210.210/eth0|firewall|10.0.0.1/eth1 ===== 10.0.0.2|server|
>
> I want to DNAT a port of my firewall on a server inside:
> $IPTABLES -t nat -A PREROUTING -i eth0 -d 210.210.210.210 -p tcp --dport 200 -j DNAT
> - --to-destination 10.0.0.2:200
>
> but the server inside only accept packets from the IP of the inside interface of the firewall :
> 10.0.0.1 so i need that the source IP address of the packet sent by someone(x.x.x.x) on the internet
> change in 10.0.0.1.
>
> I try the SNAT, the MASQUERADE:
> $IPTABLES -t nat -A POSTROUTING -o eth1 -s x.x.x.x -p tcp --dport 20000 -j SNAT --to 10.0.0.1
> or
> $IPTABLES -t nat -A POSTROUTING -o eth1 -s x.x.x.x -j MASQUERADE
> it don't work.
You are DNATing to the destination port of 200 where as you are later looking for traffic headed to 20000 and thus will never match the traffic that you DNATed.
Another point (IMHO) that you might want to consider is that if you have any client systems on the inside of the firewall that will be trying to connect to the x.x.x.x server they will never get return traffic as it will be SNATed to the firewalls internal IP. I would recommend that you add an additional "-d 10.0.0.2" match to your rule to make sure that you don't erroneously SNAT traffic that should be going else where.
Grant. . . .
next prev parent reply other threads:[~2005-04-28 3:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-26 14:18 SNAT and DNAT julien WICQUART
2005-04-28 3:30 ` Taylor, Grant [this message]
-- strict thread matches above, loose matches on Subject: below --
2003-04-04 8:24 snat and dnat Philippe Dhont (Sea-ro)
2003-04-04 14:18 ` Ralf Spenneberg
2003-04-04 7:59 Philippe Dhont (Sea-ro)
2003-04-04 9:00 ` Ralf Spenneberg
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=427058EF.8030102@riverviewtech.net \
--to=gtaylor@riverviewtech.net \
--cc=j.wicquart@newtech.fr \
--cc=netfilter@lists.netfilter.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.