Linux Netfilter discussions
 help / color / mirror / Atom feed
From: jason.faulkner@mailtrust.com
To: "G. Skillen" <g@imagination.eu.org>
Cc: netfilter@vger.kernel.org
Subject: RE: NAT and openvpn
Date: Fri, 27 Mar 2009 22:39:46 -0400 (EDT)	[thread overview]
Message-ID: <1238207986.285131659@192.168.1.202> (raw)
In-Reply-To: <20090327211404.aa4d4e6d.g@imagination.eu.org>

>I have set up a vpn (openvpn) from my home computer to a remote server, I have several >unused public IPs on the server and I would like to know how to transparently send all >traffic from e.g 123.123.123.123 (one of the spare public ips) to 10.8.0.2 (the vpn ip >of my home machine), and vice versa i guess.


% iptables -t nat -A PREROUTING -s $VPNIP -j SNAT --to-source $PUBIP
% iptables -t nat -A POSTROUTING -s $PUBIP -j DNAT --to-destination $VPNIP

That should do the trick for you for a general NAT, I'd suggest adding filtering, etc.



--
Jason Faulkner 
Linux Systems Engineer
Mailtrust, a division of Rackspace



  reply	other threads:[~2009-03-28  2:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-27 21:14 NAT and openvpn G. Skillen
2009-03-28  2:39 ` jason.faulkner [this message]
2009-03-28  2:51   ` G. Skillen
2009-03-28  6:03     ` jason.faulkner
2009-03-28  8:22       ` Mart Frauenlob
2009-03-28  9:24     ` Nikolay S. Rybaloff
2009-03-28 14:49       ` G. Skillen
2009-03-28 11:04 ` G.W. Haywood
2009-03-28 14:51   ` G. Skillen

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=1238207986.285131659@192.168.1.202 \
    --to=jason.faulkner@mailtrust.com \
    --cc=g@imagination.eu.org \
    --cc=netfilter@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