All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Opperisano <opie@817west.com>
To: netfilter@lists.netfilter.org
Subject: Re: NAT issues on a VPN tunnel
Date: Wed, 3 Nov 2004 10:49:24 -0500	[thread overview]
Message-ID: <20041103154924.GA26510@bender.817west.com> (raw)
In-Reply-To: <CARBONunxtkVO4alvoN00002350@carbon.netsvcs.com>

On Tue, Nov 02, 2004 at 11:03:53PM -0800, Chris Lyon wrote:
> > On Tue, 2004-11-02 at 19:35, Christopher Lyon wrote:
> > > I believe that would cause a problem on the VPN tunnel as the endpoints
> > > won't match. This would need to be done on the far end (site b).
> > 
> > believe what you want--it works for me.
> 
> So how do you build the tunnel?

the tunnel is built between the public external IP's of the two
gateways.

in a scenario where site A and site B both use 10.0.0.0/24 as their
internal network, and we need to build a VPN between them:

-------
Site A
-------
ipsec.conf:
  leftsubnet=172.31.1.0/24
  rightsubnet=172.31.2.0/24

# map our 10.0.0.0/24 to 172.31.1.0/24 when going over the VPN
iptables -t nat -A POSTROUTING -o ipsec0 \
  -s 10.0.0.0/24 -j NETMAP --to 172.31.1.0/24

# unmap packets from the other side to 172.31.1.0/24 to our 10.0.0.0/24
iptables -t nat -A PREROUTING -i ipsec0 \
  -d 172.31.1.0/24 -j NETMAP --to 10.0.0.0/24
   
-------
Site B
-------
ipsec.conf:
  leftsubnet=172.31.2.0/24
  rightsubnet=172.31.1.0/24

# map our 10.0.0.0/24 to 172.31.2.0/24 when going over the VPN
iptables -t nat -A POSTROUTING -o ipsec0 \
  -s 10.0.0.0/24 -j NETMAP --to 172.31.2.0/24

# unmap packets from the other side to 172.31.2.0/24 to our 10.0.0.0/24
iptables -t nat -A PREROUTING -i ipsec0 \
  -d 172.31.2.0/24 -j NETMAP --to 10.0.0.0/24

when someone in site A needs to connect to 10.0.0.100 in site B, they
connect to 172.31.2.100.

when someone in site B needs to connect to 10.0.0.100 in site A, they
connect to 172.31.1.100.

keep in mind that that packets are sent over the tunnel based on their
destination address, not their source address.  also keep in mind that
the packets are still in the clear on ipsec* interfaces and encrypted on
the physical interfaces.

dunno if this helps any, but it works for me.  this is how it makes
sense to me in my head--that each side should perform it's own
chicanery.  i'm not saying it can't be made to work some other way.

-j

--
"'Nuke the whales?' You don't really believe that, do you?
 I dunno. Gotta nuke something."
        --The Simpsons


  parent reply	other threads:[~2004-11-03 15:49 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-03  0:35 NAT issues on a VPN tunnel Christopher Lyon
2004-11-03  2:43 ` Jason Opperisano
2004-11-03 10:48   ` John A. Sullivan III
     [not found]   ` <CARBONunxtkVO4alvoN00002350@carbon.netsvcs.com>
2004-11-03 15:49     ` Jason Opperisano [this message]
2004-11-05  6:42       ` Chris Lyon
2004-11-05 10:40         ` John A. Sullivan III
2004-11-05 16:44           ` Chris Lyon
2004-11-05 16:57             ` Jason Opperisano
  -- strict thread matches above, loose matches on Subject: below --
2004-11-02 15:40 Chris Lyon
2004-11-02 16:09 ` John A. Sullivan III
2004-11-02 17:02   ` Chris Lyon
2004-11-02 18:49     ` John A. Sullivan III
2004-11-02 20:05       ` Chris Lyon
2004-11-03  0:27         ` John A. Sullivan III
2004-11-03  0:24 ` Jason Opperisano
2004-11-03 15:06 ` Michael Gale

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=20041103154924.GA26510@bender.817west.com \
    --to=opie@817west.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 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.