Linux Advanced Routing and Traffic Control list
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: lartc@vger.kernel.org
Subject: Re: [LARTC] SNAT on IPSEC tunnel with kernel 2.6/KAME tools?
Date: Fri, 12 May 2006 05:04:17 +0000	[thread overview]
Message-ID: <44641751.2090909@trash.net> (raw)
In-Reply-To: <200605031322.30125.subscriptions@navig.ca>

G Georgiev wrote:
>        OK,
> 
>         Found a solution - if some is interested - assigned the near end of 
> the IPSEC tunnel address to the internal interface; this way got a 
> POSTROUTING chain available and did an SNAT there:
> 
> ip addr add 10.253.0.2 dev eth0;
> ip route add to unicast 192.168.4.0/24 via 10.253.0.2
> iptables -t nat -A POSTROUTING -d 192.168.4.0/24 -j SNAT --to 10.253.0.2
> 
>         Looks to work just fine, despite being not so 'clean' - I would prefer 
> to have a separate interface for the VPN, not to assign an alias to eth0. 
> Does not work with lo instead of eth0.

A few hints:

- lo doesn't work because IPsec is disabled by default on loopback.
  Check /proc/sys/net/ipv4/conf/<dev>/disable_{policy,xfrm}. If
  you disable rp_filter you can even route the IPsec network to
  lo and it will work (or use dummy if working with a seperate
  interface makes it easier for your).
- you don't need the extra address and route, just SNAT is enough
- The policy match can be used to express something similar to
  "-i ipsec0" and "-o ipsec0".
_______________________________________________
LARTC mailing list
LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

      parent reply	other threads:[~2006-05-12  5:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-03 17:22 [LARTC] SNAT on IPSEC tunnel with kernel 2.6/KAME tools? G Georgiev
2006-05-05 13:39 ` Patrick McHardy
2006-05-05 16:37 ` G Georgiev
2006-05-11 14:58 ` G Georgiev
2006-05-12  2:28 ` G Georgiev
2006-05-12  5:04 ` Patrick McHardy [this message]

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=44641751.2090909@trash.net \
    --to=kaber@trash.net \
    --cc=lartc@vger.kernel.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