Linux Netfilter discussions
 help / color / mirror / Atom feed
From: "John A. Sullivan III" <john.sullivan@nexusmgmt.com>
To: Andrew McRory <amcrory@linuxsys.com>
Cc: netfilter@lists.netfilter.org
Subject: Re: SNAT Problem / Question
Date: Fri, 18 Jun 2004 08:31:25 -0400	[thread overview]
Message-ID: <1087561885.4625.13.camel@localhost> (raw)
In-Reply-To: <Pine.LNX.4.44.0406172259260.15532-100000@weta.lselinux.com>

On Thu, 2004-06-17 at 23:24, Andrew McRory wrote:
> I am having problem getting SNAT to work with tn3270 clients. My network 
> is using private IP address and is connected via freeswan ipsec to the 
> remote server. Since a large number of clients connect to the server they 
> require that all incoming connections be from our public IP. I setup this 
> rule:
> 
>   $IPT -t nat -A POSTROUTING -o ipsec0 -j SNAT -d <REMOTE_IP> \
>     --to <OUR_PUBLIC_IP>
> 
> and verified with tcpdump that the packets going out on the ipsec0 
> interface have been SNAT'ed properly. With a single client connection 
> everything operates beautifully however when a second client connects the 
> first client session breaks and the server responds with 
> 
> 	"Please close your telnet session. A connection establishment 
> 	error has been detected."
> 
> I am guessing that this is having to do with connection tracking but I am 
> not sure. Any help is greatly appreciated as I have not found anything in 
> hours of searching!!
> 
> Regards,
Something doesn't seem right (obviously!).  When one uses FreeS/WAN, the
packets will start with their original IP addresses.  They will then be
diverted to the ipsec0 interface which will encapsulate them into a
packet with the address defined by left.  Then you are changing the IP
address of the encapsulating (not the encapsulated) packet and sending
it to the other side.  I'm surprised it's being received from the other
side - does the termination point defined on the other side match the
public IP of the other gateway? I suppose it may be accidentally working
if the public IP of the SNAT gateway is the same as the IP address
defined as the local termination point in your ipsec.conf.  In any
event, once the packet gets to the other side, it is decapsulated and
the the packet seen by the mainframe has the original source address,
not the address of the gateway.  At least so I would think.  Have I
understood you configuration properly.

To achieve what I think you want to achieve, you will need to NAT before
encapsulating.  The way originally read the FreeS/WAN documentation, I
thought the packet was routed to the ipsec interface and encapsulated
before it hit the POSTROUTING chain but I found that not to be true in
my lab tests and am successfully mapping one address range to another
before passing it through ipsec.  I would imagine one could just as
easily map a subnet to a single IP.

I've never done that but, I think what you need to do is:
1)Create a NAT rule that matches all TN3270 traffic from the sending
addresses to the destination and SNAT them to the public IP of the
gateway.  N.B. this does not specify the ipsec interface as the outbound
interface.
2)Create a FreeS/WAN definition to create a tunnel between the SNAT
address and the destination.

I think that will work for you.  I believe that is how we did our VPN
network mapping in the ISCS project (http://iscs.sourceforge.net) to
allow an administrator to easily NAT one internal range to another to
work around conflicting IP address space in the same VPN cloud.  Good
luck - John
-- 
John A. Sullivan III
Chief Technology Officer
Nexus Management
+1 207-985-7880
john.sullivan@nexusmgmt.com
---
If you are interested in helping to develop a GPL enterprise class
VPN/Firewall/Security device management console, please visit
http://iscs.sourceforge.net 



  reply	other threads:[~2004-06-18 12:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-18  3:24 SNAT Problem / Question Andrew McRory
2004-06-18 12:31 ` John A. Sullivan III [this message]
2004-06-18 17:57   ` Andrew McRory

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=1087561885.4625.13.camel@localhost \
    --to=john.sullivan@nexusmgmt.com \
    --cc=amcrory@linuxsys.com \
    --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