All of lore.kernel.org
 help / color / mirror / Atom feed
* SNAT Question
@ 2004-12-14 17:30 Burton
  2004-12-14 17:51 ` Lopsch
  0 siblings, 1 reply; 18+ messages in thread
From: Burton @ 2004-12-14 17:30 UTC (permalink / raw)
  To: netfilter

I need help setting up a server I am working with.
 
I am not very knowledgeable in regards to Linux. 
 
With that in mind I have read several HOWTO's and I am convinced that SNAT
is what I need to do this.
 
What I am trying to do is I have to servers on two different T1's located on
the same switch.
 
I would like server1 (my Linux Server) to accept an incoming connecting via
its IP address on T1(1) 12..22.81.18 on port 10025 and forward that request
to server2(my Windows Mail Server)  on T1(2) 204.250.113.2 on port 25
 
I have tried several combinations of 
iptables -t nat -A POSTROUTING -p tcp -o eth0 -j SNAT --dport 10025 --to
204.250.113.2:25 
 
What am I doing wrong or am I looking at the wrong tool.
 

^ permalink raw reply	[flat|nested] 18+ messages in thread
* RE: SNAT question
@ 2004-11-15 18:33 Gary W. Smith
  0 siblings, 0 replies; 18+ messages in thread
From: Gary W. Smith @ 2004-11-15 18:33 UTC (permalink / raw)
  To: netfilter

I went back to the sample source and changes a couple little items to march how they had it.  It still fails for each internel request for the external ip with the exception of the firewall itself.
 
ping 206.17.98.52 from machine 206.17.98.60 results in a return from 192.168.0.52.  
 
#Incoming Maps
[0:0] -A PREROUTING -d 206.17.98.51 -j DNAT --to-destination 192.168.0.51
[0:0] -A PREROUTING -d 206.17.98.52 -j DNAT --to-destination 192.168.0.52
...
[0:0] -A PREROUTING -d 206.17.98.62 -j DNAT --to-destination 192.168.0.62
#Outgoing Maps 
[0:0] -A POSTROUTING -d 206.17.98.51 -j SNAT --to-source 192.168.0.51
[0:0] -A POSTROUTING -d 206.17.98.52 -j SNAT --to-source 192.168.0.52
...
[0:0] -A POSTROUTING -d 206.17.98.62 -j SNAT --to-source 192.168.0.62
[0:0] -A POSTROUTING -o eth0 -j SNAT --to-source 206.17.98.50
#************************************************************
[0:0] -A OUTPUT -d 192.168.0.51 -j DNAT --to-destination 206.17.98.51
[0:0] -A OUTPUT -d 192.168.0.52 -j DNAT --to-destination 206.17.98.52
...
[0:0] -A OUTPUT -d 192.168.0.62 -j DNAT --to-destination 206.17.98.62

I know that I must be missing something simple.
 
Gary Smith
 

________________________________

From: netfilter-bounces@lists.netfilter.org on behalf of Gary W. Smith
Sent: Sun 11/14/2004 2:53 PM
To: netfilter@lists.netfilter.org
Subject: SNAT question



I'm having a problem with DNAT/SNAT.

I have this on a couple firewalls at different places and it works
great.  I'm implementing this on a new firewall based on RHEL3 and it
seems to work great for everything except local servers with external
IP's.  Trying to access 206.14.210.52 internally returns me
192.168.0.52.  If I access it from the firewall it all works fine.  If I
access from another workstation or the server itself then it returns the
local IP as part of the ping.

Some time ago on another firewall with multiple segments someone told me
to put this:
-A POSTROUTING -s 192.168.0.0/255.255.255.0 -d 192.168.0.52 -j SNAT
--to-source 206.17.98.52

On another firewall at another location I found that they had
-A POSTROUTING -s 192.168.0.52 -d 192.168.0.52 -j SNAT --to-source
206.17.98.52

Something to note that this is a custom RHEL3v3 compile with
pptp-conntrack compiled in.  We also recompiled iptables using the new
userspace changes.

The location where I got the information regarding the original
DNAT/SNAT is:
http://iptables-tutorial.frozentux.net/iptables-tutorial.html#DNATTARGET


Here is the actual PRE/POST/OUT routing section

[0:0] -A PREROUTING -d 206.14.210.51 -j DNAT --to-destination
192.168.0.51
[0:0] -A PREROUTING -d 206.14.210.52 -j DNAT --to-destination
192.168.0.52
...
[0:0] -A PREROUTING -d 206.14.210.62 -j DNAT --to-destination
192.168.0.62

[0:0] -A POSTROUTING -s 192.168.0.51 -o eth0 -j SNAT --to-source
206.14.210.51
[0:0] -A POSTROUTING -s 192.168.0.52 -o eth0 -j SNAT --to-source
206.14.210.52
#[0:0] -A POSTROUTING -s 192.168.0.52 -d 192.168.0.52 -j SNAT
--to-source 206.17.98.52
...
[0:0] -A POSTROUTING -s 192.168.0.62 -o eth0 -j SNAT --to-source
206.17.98.62
[0:0] -A POSTROUTING -o eth0 -j SNAT --to-source 206.17.98.50

[0:0] -A OUTPUT -d 206.17.98.51 -j DNAT --to-destination 192.168.0.51
[0:0] -A OUTPUT -d 206.17.98.52 -j DNAT --to-destination 192.168.0.52
...
[0:0] -A OUTPUT -d 206.17.98.62 -j DNAT --to-destination 192.168.0.62





^ permalink raw reply	[flat|nested] 18+ messages in thread
* SNAT question
@ 2004-11-14 22:53 Gary W. Smith
  0 siblings, 0 replies; 18+ messages in thread
From: Gary W. Smith @ 2004-11-14 22:53 UTC (permalink / raw)
  To: netfilter

I'm having a problem with DNAT/SNAT.

I have this on a couple firewalls at different places and it works
great.  I'm implementing this on a new firewall based on RHEL3 and it
seems to work great for everything except local servers with external
IP's.  Trying to access 206.14.210.52 internally returns me
192.168.0.52.  If I access it from the firewall it all works fine.  If I
access from another workstation or the server itself then it returns the
local IP as part of the ping.

Some time ago on another firewall with multiple segments someone told me
to put this:
-A POSTROUTING -s 192.168.0.0/255.255.255.0 -d 192.168.0.52 -j SNAT
--to-source 206.17.98.52

On another firewall at another location I found that they had 
-A POSTROUTING -s 192.168.0.52 -d 192.168.0.52 -j SNAT --to-source
206.17.98.52

Something to note that this is a custom RHEL3v3 compile with
pptp-conntrack compiled in.  We also recompiled iptables using the new
userspace changes.

The location where I got the information regarding the original
DNAT/SNAT is:
http://iptables-tutorial.frozentux.net/iptables-tutorial.html#DNATTARGET


Here is the actual PRE/POST/OUT routing section

[0:0] -A PREROUTING -d 206.14.210.51 -j DNAT --to-destination
192.168.0.51
[0:0] -A PREROUTING -d 206.14.210.52 -j DNAT --to-destination
192.168.0.52
...
[0:0] -A PREROUTING -d 206.14.210.62 -j DNAT --to-destination
192.168.0.62

[0:0] -A POSTROUTING -s 192.168.0.51 -o eth0 -j SNAT --to-source
206.14.210.51
[0:0] -A POSTROUTING -s 192.168.0.52 -o eth0 -j SNAT --to-source
206.14.210.52
#[0:0] -A POSTROUTING -s 192.168.0.52 -d 192.168.0.52 -j SNAT
--to-source 206.17.98.52
...
[0:0] -A POSTROUTING -s 192.168.0.62 -o eth0 -j SNAT --to-source
206.17.98.62
[0:0] -A POSTROUTING -o eth0 -j SNAT --to-source 206.17.98.50

[0:0] -A OUTPUT -d 206.17.98.51 -j DNAT --to-destination 192.168.0.51
[0:0] -A OUTPUT -d 206.17.98.52 -j DNAT --to-destination 192.168.0.52
...
[0:0] -A OUTPUT -d 206.17.98.62 -j DNAT --to-destination 192.168.0.62



^ permalink raw reply	[flat|nested] 18+ messages in thread
[parent not found: <20040917181300.76253.qmail@web61109.mail.yahoo.com>]
* SNAT question
@ 2004-09-16 17:20 darmian martinez
  2004-09-17 20:48 ` John A. Sullivan III
  0 siblings, 1 reply; 18+ messages in thread
From: darmian martinez @ 2004-09-16 17:20 UTC (permalink / raw)
  To: netfilter

Hello,
 
I am trying to change the source ip address of icmp reply packets of the
firewall, just because i am trying to hide the firewall ip address in the case someone makes a traceroute to my protected network. I dont want
to block the icmp packet, just to change the source ip address.
i try it with:
 
iptables -t nat -I POSTROUTING -s [FIREWALL_IP] -d [TRACEROUTE_ORIGINATOR] -m state --state RELATED,NEW,ESTABLISHED -j SNAT --to [FAKE_IP_ADDRESS]
 
it's does not work. anyone know how to make it?
 
thanks.

		100mb gratis, Antivirus y Antispam
Correo Yahoo!, el mejor correo web del mundo
¡Tenelo ya!

^ permalink raw reply	[flat|nested] 18+ messages in thread
* SNAT question
@ 2004-03-01 23:56 Felipe
  2004-03-02  0:22 ` Antony Stone
  0 siblings, 1 reply; 18+ messages in thread
From: Felipe @ 2004-03-01 23:56 UTC (permalink / raw)
  To: netfilter

It's necessary to set up phisically the public address used in SNAT rule ?
For this rule:

iptables -t nat -A POSTROUTING -s 172.21.0.0/16 -j SNAT --to 200.110.2.181

For that rule, its necessay set up phisically the IP 200.110.2.181 over the interface ?

Thanks for your response


Felipe


^ permalink raw reply	[flat|nested] 18+ messages in thread
* SNAT question
@ 2004-02-20 20:15 John Black
  2004-02-20 21:05 ` Antony Stone
  2004-02-20 21:08 ` John A. Sullivan III
  0 siblings, 2 replies; 18+ messages in thread
From: John Black @ 2004-02-20 20:15 UTC (permalink / raw)
  To: netfilter

Everything works, when i do the lazy way and go to the web page www.whatismyipaddress.com.


but my question is when i went to the MS chat room, it was showing me the 192.168.x.x
ipaddress.

why is this?

john



http://www.arbbs.net/


^ permalink raw reply	[flat|nested] 18+ messages in thread
* SNAT question
@ 2003-01-27 19:46 Jean-Rene Cormier
  0 siblings, 0 replies; 18+ messages in thread
From: Jean-Rene Cormier @ 2003-01-27 19:46 UTC (permalink / raw)
  To: netfilter

Okay here is the thing. I have a full Class C to work with and I want to
make a Linux Firewall/NAT box using Netfilter and I was wondering, say I
have 50 IPs in my Class C I want to use for SNAT. Do I have to add all
50 IPs on the Linux box's interface? 

Thanks

Jean-Rene Cormier



^ permalink raw reply	[flat|nested] 18+ messages in thread
* RE: SNAT question
@ 2002-10-31 12:18 mailinglists
  0 siblings, 0 replies; 18+ messages in thread
From: mailinglists @ 2002-10-31 12:18 UTC (permalink / raw)
  To: 'netfilter@lists.samba.org'

Hi

this is my problem:

+ iptables -t mangle -A PREROUTING -i eth1 -j TTL --ttl-inc 1
iptables: No chain/target/match by that name

modprobe ipt_ttl is in my script. 
According to 
http://cert.uni-stuttgart.de/archive/usenet/comp.os.linux.security/2002/08/m
sg00458.html
there should be two ttl modules in
/lib/modules/2.4.18-4GB/kernel/net/ipv4/netfilter/.
ipt_TTL for the target
ipt_ttl for matching.

ipt_TTL isnt in the modules directory.

How am I going to get this to work?

Thanks,
Philipp

PS: 
System is Suse 8.0, Kernel 2.4.18, iptables 1.2.25


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2004-12-14 17:51 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-12-14 17:30 SNAT Question Burton
2004-12-14 17:51 ` Lopsch
  -- strict thread matches above, loose matches on Subject: below --
2004-11-15 18:33 SNAT question Gary W. Smith
2004-11-14 22:53 Gary W. Smith
     [not found] <20040917181300.76253.qmail@web61109.mail.yahoo.com>
2004-09-18 21:46 ` Alexey Toptygin
2004-09-19 17:10   ` darmian martinez
2004-09-21 13:11     ` Jason Opperisano
2004-09-16 17:20 darmian martinez
2004-09-17 20:48 ` John A. Sullivan III
2004-03-01 23:56 Felipe
2004-03-02  0:22 ` Antony Stone
2004-03-02  1:28   ` Felipe
2004-02-20 20:15 John Black
2004-02-20 21:05 ` Antony Stone
2004-02-21  3:33   ` John Black
2004-02-20 21:08 ` John A. Sullivan III
2003-01-27 19:46 Jean-Rene Cormier
2002-10-31 12:18 mailinglists

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.