<?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>A Million Monkeys &#187; hamachi</title>
	<atom:link href="http://www.monkeedev.co.uk/blog/tag/hamachi/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.monkeedev.co.uk/blog</link>
	<description>Surviving life as a sysadmin.</description>
	<lastBuildDate>Wed, 08 Sep 2010 10:28:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Setting up a hamachi VPN</title>
		<link>http://www.monkeedev.co.uk/blog/2007/06/22/setting-up-a-hamachi-vpn/</link>
		<comments>http://www.monkeedev.co.uk/blog/2007/06/22/setting-up-a-hamachi-vpn/#comments</comments>
		<pubDate>Fri, 22 Jun 2007 08:07:03 +0000</pubDate>
		<dc:creator>Kris</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[hamachi]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[vpn]]></category>

		<guid isPermaLink="false">http://www.monkeedev.co.uk/blog/2007/06/22/setting-up-a-hamachi-vpn/</guid>
		<description><![CDATA[I&#8217;ve had a pretty stable VPN setup on my networks for some time now, and I thought others might like a guide on how to get everything working. I had trouble following the threads explaining the concepts, so I spent some time getting it all working myself. This can all be done using the free [...]]]></description>
			<content:encoded><![CDATA[<p><font class="postbody">I&#8217;ve had a pretty stable VPN setup on my networks for some time now, and I thought others might like a guide on how to get everything working. I had trouble following the threads explaining the concepts, so I spent some time getting it all working myself.</font></p>
<p><font class="postbody">This can all be done using the free hamachi version. I have a premium license so I can make the network more secure by having to authorise new members.</font></p>
<p><font class="postbody">This guide covers connecting a windows XP machine to private networks with linux and windows machines acting as the routing nodes.</font></p>
<p><font class="postbody">I have 2 networks in my office, 10.1.0.0 and 10.2.0.0. I use the VPN for connecting my laptop to these networks from home.</font></p>
<p><font class="postbody"><font style="font-weight: bold">Setting up the &#8216;client&#8217; XP machine (the one which needs to VPN into the networks)</font><br />
- Download and install hamachi<br />
- Create a new network specifically for the VPN.<br />
- Add &#8216;RoutedTunneling 1&#8242; to hamachi-override.ini and restart Hamachi. You may need to create this file by clicking Configure, Preferences, System, Open Configuration Folder &#8211; then create hamachi-override.ini<br />
- Click Start, Run and type &#8216;regedit&#8217;, then set HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesTcpipParametersIPEnableRouter to 1<br />
- Reboot and open hamachi.</font></p>
<p><font class="postbody"><font style="font-weight: bold">First &#8216;server&#8217; &#8211; Windows (10.1.0.53 is the example local IP)</font><br />
Follow the instructions above, but instead of creating a new network, join the one you previously created. That&#8217;s all you need to do to get a windows server set up.</font></p>
<p><font class="postbody"><font style="font-weight: bold">Linux &#8216;servers&#8217; (10.2.0.201 on my local network)</font><br />
- cd /opt<br />
- wget <a href="http://files.hamachi.cc/linux/hamachi-0.9.9.9-20-lnx.tar.gz" target="_blank">http://files.hamachi.cc/linux/hamachi-0.9.9.9-20-lnx.tar.gz</a><br />
- tar -zxvf hamachi-0.9.9.9-20-lnx.tar.gz<br />
- cd hamachi-0.9.9.9-20-lnx/<br />
- mkdir /dev/net<br />
- make install<br />
- tuncfg/tuncfg<br />
- hamachi-init<br />
- hamachi start<br />
- hamachi set-nick servername<br />
- hamachi login<br />
- hamachi join networkname networkpassword<br />
- hamachi go-online networkname<br />
- echo 1 &gt; /proc/sys/net/ipv4/ip_forward</font></p>
<p><font class="postbody">Note that whenever the linux machines are rebooted, /proc/sys/net/ipv4/ip_forward will reset to 0.</font></p>
<p><font class="postbody">The server nodes are now setup to forward IPv4 packets around the network.</font></p>
<p><font class="postbody">This next step is where most problems will occur. The server nodes will forward packets to the network, but other machines on the local networks don&#8217;t know where to send data to 5.x.x.x addresses. I set up rules on our firewall which work something like:<br />
Requests to 5.0.0.0/8 need to be routed to 10.1.0.53 on the 10.1 network<br />
Requests to 5.0.0.0/8 need to be routed to 10.2.0.201 on the 10.2 network<br />
This is one rule for each of the networks I need to access. I&#8217;m not sure how to do this in different firewall setups so I&#8217;m not much help here.</font></p>
<p><font class="postbody">Everything is now setup, but the &#8216;client&#8217; node doesnt know where to send packets to any of the 10.1 or 10.2 networks. To fix this, we need to create routes on the machine. I created 2 batch files, one to connect the VPN, and one to disconnect.</font></p>
<p><font class="postbody"><font style="font-weight: bold">Connect batch file</font></font></p>
<table align="center" border="0" cellpadding="3" cellspacing="1" width="90%">
<tr>
<td><font class="genmed"><strong><br />
</strong></font></td>
</tr>
<tr>
<td class="code">@title Connecting Hamachi VPN Tunnels<br />
@echo Connecting Hamachi VPN Tunnels<br />
@echo -connecting to 10.1.0.0 network&#8230;<br />
@route add 10.1.0.0 mask 255.255.255.0 [HAMACHI ADDRESS OF MACHINE ON 10.1]<br />
@echo -connecting to 10.2.0.0 network&#8230;<br />
@route add 10.2.0.0 mask 255.255.255.0 [HAMACHI ADDRESS OF MACHINE ON 10.2]<br />
@echo .<br />
@echo VPN Connected.<br />
@echo To disconnect, run the disable batch file or reboot the system.<br />
@echo .<br />
@pause</td>
</tr>
</table>
<p><font class="postbody"><br />
Obviously you&#8217;ll need to put the hamachi IP&#8217;s of each of the server nodes in this file.</font></p>
<p><font class="postbody"><font style="font-weight: bold">Disconnect batch file</font></font></p>
<table align="center" border="0" cellpadding="3" cellspacing="1" width="90%">
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td class="code">@title Disable Hamachi VPN Tunnels<br />
@echo Disconnecting Hamachi VPN Tunnels<br />
@echo -disconnecting 10.1.0.0<br />
@route delete 10.1.0.0<br />
@echo -disconnecting 10.2.0.0<br />
@route delete 10.2.0.0<br />
@echo .<br />
@echo VPN Disconnected<br />
@echo .<br />
@pause</td>
</tr>
</table>
<p><font class="postbody">At this point everything is set up and ready to connect. You will need full connectivity to all the server nodes which you are using (green icons in hamachi).</font></p>
<p><font class="postbody">Then you run the batch file to connect the VPN (or just type the route commands into a command prompt manually). Test pinging the local address of the server nodes, then other addresses inside the remote network.</font></p>
<p><font class="postbody"><font style="font-weight: bold">Diagnostics</font><br />
First, try pinging the local address of one of the server nodes (10.1.0.53 in my example). If this doesnt work, then my guess is that the route command hasn&#8217;t been done correctly.<br />
Next, try pinging another machine on the local network (10.1.0.50 for example). If this doesnt work, then it&#8217;s likely that the server node isn&#8217;t forwarding the packets correctly, or the responses from the machine you&#8217;re pinging aren&#8217;t being sent back to the server node properly &#8211; check the firewall routing and make sure you&#8217;ve set /proc/sys/net/ipv4/ip_forward to 1.</font></p>
<p><font class="postbody">Note that this whole setup will only work if the client node is actually off of the local network at the time you try to connect. By this, I mean that when I am at work, my laptop has the IP 10.1.0.56 and it connects out via 10.1.0.1 &#8211; obviously the VPN wont work while I&#8217;m at work because the route command will override the default gateway route and stop me connecting out at all. </font></p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.monkeedev.co.uk%2Fblog%2F2007%2F06%2F22%2Fsetting-up-a-hamachi-vpn%2F&amp;title=Setting+up+a+hamachi+VPN" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.monkeedev.co.uk/blog/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.monkeedev.co.uk%2Fblog%2F2007%2F06%2F22%2Fsetting-up-a-hamachi-vpn%2F&amp;title=Setting+up+a+hamachi+VPN" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.monkeedev.co.uk/blog/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.monkeedev.co.uk%2Fblog%2F2007%2F06%2F22%2Fsetting-up-a-hamachi-vpn%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://www.monkeedev.co.uk/blog/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.monkeedev.co.uk%2Fblog%2F2007%2F06%2F22%2Fsetting-up-a-hamachi-vpn%2F&amp;title=Setting+up+a+hamachi+VPN" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.monkeedev.co.uk/blog/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.monkeedev.co.uk%2Fblog%2F2007%2F06%2F22%2Fsetting-up-a-hamachi-vpn%2F&amp;title=Setting+up+a+hamachi+VPN" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://www.monkeedev.co.uk/blog/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.monkeedev.co.uk%2Fblog%2F2007%2F06%2F22%2Fsetting-up-a-hamachi-vpn%2F&amp;title=Setting+up+a+hamachi+VPN" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.monkeedev.co.uk/blog/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.monkeedev.co.uk%2Fblog%2F2007%2F06%2F22%2Fsetting-up-a-hamachi-vpn%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://www.monkeedev.co.uk/blog/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Setting+up+a+hamachi+VPN+@+http%3A%2F%2Fwww.monkeedev.co.uk%2Fblog%2F2007%2F06%2F22%2Fsetting-up-a-hamachi-vpn%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://www.monkeedev.co.uk/blog/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.monkeedev.co.uk/blog/2007/06/22/setting-up-a-hamachi-vpn/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
