<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Rian&#039;s Really Good Technoblog! &#187; NAT</title>
	<atom:link href="http://riansreallygoodtechnoblog.com/tag/nat/feed/" rel="self" type="application/rss+xml" />
	<link>http://riansreallygoodtechnoblog.com</link>
	<description>Technology tidbits from adapters to z... z... uh... zip files!</description>
	<lastBuildDate>Thu, 22 Jul 2010 01:09:59 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Routing Over PPTP VPN</title>
		<link>http://riansreallygoodtechnoblog.com/2009/11/16/routing-over-pptp-vpn/</link>
		<comments>http://riansreallygoodtechnoblog.com/2009/11/16/routing-over-pptp-vpn/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 22:18:52 +0000</pubDate>
		<dc:creator>rian</dc:creator>
				<category><![CDATA[Infrastructure]]></category>
		<category><![CDATA[Remote Access]]></category>
		<category><![CDATA[NAT]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[routing]]></category>
		<category><![CDATA[VPN]]></category>

		<guid isPermaLink="false">http://riansreallygoodtechnoblog.com/2009/11/16/routing-over-pptp-vpn/</guid>
		<description><![CDATA[Granted, I tend to be a little&#8230; extreme&#8230; in the oddly setup network scenarios.  Still, there are times when I need to make my freaky little combination work with a client&#8217;s environment without reconfiguring their network to meet my own needs.
I have a client that has a PPTP-based VPN solution in place.  While [...]]]></description>
			<content:encoded><![CDATA[<p>Granted, I tend to be a little&#8230; extreme&#8230; in the oddly setup network scenarios.  Still, there are times when I need to make my freaky little combination work with a client&#8217;s environment without reconfiguring their network to meet my own needs.</p>
<p>I have a client that has a PPTP-based VPN solution in place.  While I prefer a more robust SSL or IPSec VPN&#8211; this isn&#8217;t about me.  That&#8217;s what they have, and it works for them.  I needed to make my tools work with that situation.</p>
<p>On my end, though, I run a Linux desktop with virtualized (ask me later) instances of client servers or development environments.  In this case, I had a Windows XP guest system running, but I needed to be able to access my Linux system as well on their network.  So, while Linux&#8217;s NetworkManager would happily make a connection to their relatively oldish VPN server device, I couldn&#8217;t make another from the XP client at the same time.</p>
<p>What&#8217;s more, their VPN server device was having no part of routing my network&#8217;s traffic.  (Note: I am not specifying the parts involved here because I don&#8217;t want to start a &#8216;you should have done THIS!&#8217; discussion.  I&#8217;m very much a &#8216;get it working and move on&#8217; person.)</p>
<p><span id="more-28"></span></p>
<p>OK, so, I had a couple of choices.  I could go into their network and see if I could reroute all the traffic that looked like it came from me back through the VPN (I actually tried that, and it didn&#8217;t work, but it was no good anyway since it was too invasive).  Worse, I could reconfigure their VPN device to route my traffic, but again, that&#8217;s their machine, and I wasn&#8217;t going to spend all day figuring out how to accomplish that&#8211; on a device that isn&#8217;t even made anymore.</p>
<p>That&#8217;s all a long build-up to what turned out to work, not require anything on their side, and take me all of about 5 minutes.  The answer was to NAT the traffic from my guest OS to the Linux box.  (NAT = network address translation.  That&#8217;s when you wrap all the traffic from your network in your exposed single address, so that routers treat it like it came from that machine.  That&#8217;s how you can have a bunch of computers in your house running on that one IP address that comes with your DSL.)</p>
<p>192.168.1.X = Linux box with actual VPN connection<br />
10.0.0.131 = The assigned VPN address for that machine on the client network<br />
192.168.1.Y = XP virtual instance<br />
10.0.0.0/24 = client network</p>
<p>Step 1) Route the traffic from the XP client.</p>
<pre>route add 10.0.0.0 mask 255.255.255.0 192.168.1.X</pre>
<p>Step 2) Make sure the Linux box is routing traffic.</p>
<pre>echo 1 &gt; /proc/sys/net/ipv4/ip_forward</pre>
<p><em>(set it permanently in /etc/sysctl.conf as net.ipv4.conf.default.forwarding=1)</em></p>
<p>Step 3) Setup iptables to NAT the traffic.  (Connect to VPN first, of course.)</p>
<pre>iptables -t nat -A POSTROUTING -d 10.0.0.0/24 -o ppp0 -j SNAT --to 10.0.0.131</pre>
<p>What you see there is my adding a rule to iptables that tells it that the last thing to do with any packets going to my client&#8217;s network is to wrap them in the aforementioned outer envelope with a return address of the Linux box&#8217;s assigned IP address in the client&#8217;s network.</p>
<p>If all goes well, the receiving end recognizes that this is a NATed packet, unwraps it, does whatever with it, and responds to the source with another packet wrapped similarly in an envelope that delivers it to the Linux box, where it&#8217;s unwrapped and passed back to the originating XP machine.</p>
<p>And, for what it&#8217;s worth, it did go well.  I was able to route both machines&#8217; traffic over the same connection without having to noodle with the client&#8217;s internal routing at all.</p>
<p>&#8220;I love it when a plan comes together.&#8221;  &#8212; Hannibal Smith, The A-Team</p>
]]></content:encoded>
			<wfw:commentRss>http://riansreallygoodtechnoblog.com/2009/11/16/routing-over-pptp-vpn/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
