Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Raymond Leach <raymondl@knowledgefactory.co.za>
To: Ben <bench@silentmedia.com>
Cc: NetFilter <netfilter@lists.samba.org>
Subject: Re: simple nat question
Date: Wed, 03 Jul 2002 09:00:52 +0200	[thread overview]
Message-ID: <3D22A124.8050606@knowledgefactory.co.za> (raw)
In-Reply-To: Pine.LNX.4.30.0207021225140.7072-100000@gilgamesh.eos.SilentMedia.com

Hi Ben

iptables is clever enough to know and remember where the original packet 
came from and will automagically do the translation necessary for the 
return packets.

Ray

Ben wrote:
> I've got a basic nat setup:
> 
>   internet
>      |
> +====+=====+ eth0: 1.2.3.4
> | firewall |
> +====+=====+ eth1: 10.0.0.1
>      |
> +====+=====+ eth0: 10.0.0.2
> |  server  |
> +==========+
> 
> 
> What I would like is for packets coming from the server (10.0.0.2) to get
> SNAT'd to the firewall's IP address, 1.2.3.4. It seems easy enough to do:
> 
> iptables -t nat -A POSTROUTING -o eth0 -s 10.0.0.2 -j SNAT --to 1.2.3.4
> 
> But now I don't see how return packets are going to make it back to my
> server, because the firewall is going to think they are destined for it.
> If I add the rule:
> 
> iptables -t nat -A PREROUTING -d 1.2.3.4 -i ! eth0 -j DNAT --to 10.0.0.2
> 
> Then it seems I loose the ability for the firewall to run anything
> accessable to the outside world, like ssh.
> 
> 



      parent reply	other threads:[~2002-07-03  7:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-02 19:34 simple nat question Ben
2002-07-02 19:55 ` Antony Stone
2002-07-02 20:13   ` Jan Humme
2002-07-02 20:18     ` Antony Stone
2002-07-02 20:47       ` Jan Humme
2002-07-02 20:51         ` Ben
2002-07-02 20:58           ` Antony Stone
2002-07-02 21:08             ` Jan Humme
2002-07-02 20:53         ` Antony Stone
2002-07-02 20:37   ` Ben
2002-07-02 20:18 ` Aldo S. Lagana
2002-07-03  7:00 ` Raymond Leach [this message]

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=3D22A124.8050606@knowledgefactory.co.za \
    --to=raymondl@knowledgefactory.co.za \
    --cc=bench@silentmedia.com \
    --cc=netfilter@lists.samba.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