From: Grant Taylor <gtaylor@riverviewtech.net>
To: Mail List - Netfilter <netfilter@lists.netfilter.org>
Subject: Re: SNAT before IPSec
Date: Thu, 07 Jun 2007 12:07:53 -0500 [thread overview]
Message-ID: <46683B69.8000303@riverviewtech.net> (raw)
In-Reply-To: <8bd3dfad0706070840i2b80fa4bl5a9a4ae5973b0e01@mail.gmail.com>
On 06/07/07 10:40, noa levy wrote:
> Well, I agree with you in principle, but it's been this way for
> years, so routing practices are in place to handle it. I'm trying to
> recreate the setup we have now, which is using commercial VPN
> gateways, with Linux-based ones, but the addressing scheme is a
> given, I have no control over it.
Ah, you have a "Double NAT scenario". What fun.
In short, you have two networks with the same subnet A.B.C.x/24 that
need to talk to each other. So, you make each network think that the
other is D.E.F.x/24. This way, either network can reach the other
network by using the D.E.F.x/24 addresses.
Traditionally, double NAT is done on two different systems b/c of
conflicts. However I suspect that it could be done on one system with
multiple routing tables. I'll have to think on this as to how to
possibly make this happen. I'd need you to do some testing on your end
to let me know if it would work or not as I don't have a test bed that
will encompasses this at present.
With the traditional double nat, you have a fake subnet that is remapped
in to the local network. The routers know how to get between each other
using the fake network.
A.B.C.x/24 <router A> --- (vpn) --- <router B> A.B.C.x/24
Router A thinks that D.E.F.x/24 is available via router B.
Router B thinks that D.E.F.x/24 is available via router A.
Both router A and router B do a network map to translate any incoming
traffic destined to D.E.F.x/24 to A.B.C.x/24. Thus when any traffic
comes in to either router from A.B.C.9 destined to D.E.F.3, it DNATs the
traffic down to A.B.C.3 AND SNATs the traffic up to D.E.F.9. Thus the
real receiving host will see traffic from D.E.F.9 to A.B.C.3. With the
real receiving host having what it thinks to be valid source and
destination IPs, it can communicate just like normal. When the real
receiving host replies to the real sending host, the traffic goes out to
D.E.F.9. Then the other router will see traffic coming in from A.B.C.3
to D.E.F.9 it will DNAT the traffic to be to A.B.C.9 and SNAT the
traffic to be from D.E.F.3. Notice how we now have a complete
by-directional route between two very different subnets that share the
same subnet address space? Interesting isn't it? Complex though as it
is, it does work and is done a LOT.
See if this helps you at all.
Seeing as how your subnets were suppose to be set up identically I'm
going to presume that servers and routers on the subnets have the same
IP addresses. Thus, you would probably be able to get away using NETMAP
target. I.e.
iptables -t nat -A PREROUTING -i $WAN -d D.E.F.x/24 -j NETMAP --to
A.B.C.x/24
iptables -t nat -A POSTROUTING -o $LAN -s A.B.C.x/24 -j NETMAP --to
D.E.F.x/24
This should cause the NETMAPing to happen at the remote end of the vpn
link and (hopefully) not confuse the router at the local end of the vpn
link.
Grant. . . .
P.S. I said "fun right???". :0
next prev parent reply other threads:[~2007-06-07 17:07 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-05 12:29 SNAT before IPSec noa levy
2007-06-05 12:56 ` Yasuyuki KOZAKAI
2007-06-05 14:36 ` Grant Taylor
2007-06-05 20:15 ` Jorge Davila
2007-06-05 20:28 ` Grant Taylor
2007-06-05 20:45 ` Jorge Davila
2007-06-05 23:53 ` Grant Taylor
2007-06-06 15:39 ` Jorge Davila
2007-06-06 18:48 ` Grant Taylor
2007-06-05 21:29 ` noa levy
2007-06-05 22:40 ` Jorge Davila
2007-06-05 22:40 ` noa levy
2007-06-05 22:59 ` Jorge Davila
2007-06-05 23:05 ` noa levy
2007-06-06 15:47 ` Jorge Davila
2007-06-07 15:40 ` noa levy
2007-06-07 16:36 ` Jorge Davila
2007-06-07 17:07 ` Grant Taylor [this message]
2007-06-07 18:03 ` Grant Taylor
2007-06-07 20:57 ` Jorge Davila
2007-06-08 17:57 ` Grant Taylor
2007-06-05 22:43 ` Jorge Davila
-- strict thread matches above, loose matches on Subject: below --
2007-06-04 22:43 noa levy
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=46683B69.8000303@riverviewtech.net \
--to=gtaylor@riverviewtech.net \
--cc=gtaylor+reply@riverviewtech.net \
--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.