Linux Netfilter discussions
 help / color / mirror / Atom feed
From: "Peter Marshall" <peter.marshall@caris.com>
To: "Piszcz, Justin Michael" <justin.piszcz@mitretek.org>,
	netfilter <netfilter@lists.netfilter.org>
Subject: Re: to snat or to dnat .. that is the question
Date: Tue, 1 Jun 2004 11:51:01 -0300	[thread overview]
Message-ID: <146b01c447e7$db846180$49caa8c0@caris.priv> (raw)
In-Reply-To: 5D3C2276FD64424297729EB733ED1F76062433BA@email1.mitretek.org

yes, my firewall is the default route on all internal boxes

----- Original Message ----- 
From: "Piszcz, Justin Michael" <justin.piszcz@mitretek.org>
To: "Peter Marshall" <peter.marshall@caris.com>; "netfilter"
<netfilter@lists.netfilter.org>
Sent: Tuesday, June 01, 2004 11:42 AM
Subject: RE: to snat or to dnat .. that is the question


If the box 192.168.0.20 does not have the firewall's IP as its default
route, then it will not work correctly (DNAT), I am not sure about SNAT.


-----Original Message-----
From: netfilter-admin@lists.netfilter.org
[mailto:netfilter-admin@lists.netfilter.org] On Behalf Of Peter Marshall
Sent: Tuesday, June 01, 2004 10:30 AM
To: netfilter
Subject: to snat or to dnat .. that is the question

Hi again.

I am at a bit of a quandary, and am not sure what to do.

Let the external interface on my firewall be 100.100.100.100
I have an internal box; 192.168.0.20 that needs to connect to an
external
box 200.200.200.200 on port 2000.

I want the internal box to connect to hit my firewall on a different
port ..
say 15000

so basically

start: .... -s 192.168.0.20 -d 200.200.200.200 --dport 15000
after firewall -s 100.100.100.100 -d 200.200.200.200 --dport 2000

How can I do this ?

I started out with:

$IPT -t nat -A POSTROUTING -d 200.200.200.200 --dport 15000 -p tcp -i
eth0 \
       -j SNAT --to-source 100.100.100.100

But this does not change the destination port (obviously). I thought
about
doing the following

$IPT -t nat -A PREROUTING -d 100.100.100.100 --dport 15000 -p tcp -i
eth0 \
         -j DNAT --to-destination 200.200.200.200 --dport 2000

However, I don't think that this will change my source address.  Also,
will
this even forwarded the packets ?  They would be coming on the input
chain
would they not ?


Thank you for the help.
Peter Marshall


Peter Marshall, BCS
Network Administrator, CARIS
115 Waggoners Lane, Fredericton NB, E3B 2L4 CANADA
Phone:  (506) 458-8533 (Reception)








  reply	other threads:[~2004-06-01 14:51 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-01 14:42 to snat or to dnat .. that is the question Piszcz, Justin Michael
2004-06-01 14:51 ` Peter Marshall [this message]
2004-06-01 15:16   ` Alistair Tonner
2004-06-01 16:27     ` Peter Marshall
2004-06-01 17:50       ` Alistair Tonner
  -- strict thread matches above, loose matches on Subject: below --
2004-06-01 17:38 Daniel Chemko
2004-06-01 17:12 Daniel Chemko
2004-06-01 17:30 ` Peter Marshall
2004-06-01 17:52 ` Alistair Tonner
2004-06-01 14:30 Peter Marshall

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='146b01c447e7$db846180$49caa8c0@caris.priv' \
    --to=peter.marshall@caris.com \
    --cc=justin.piszcz@mitretek.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox