<?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>King of the Potato People &#187; routeros</title>
	<atom:link href="http://www.potato-people.com/blog/tag/routeros/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.potato-people.com/blog</link>
	<description>Code, photos and ramblings of Rick Hodger</description>
	<lastBuildDate>Fri, 27 Aug 2010 09:56:59 +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>IPsec VPNs for Mikrotik RouterOS</title>
		<link>http://www.potato-people.com/blog/2009/10/ipsec-vpns-for-mikrotik-routeros/</link>
		<comments>http://www.potato-people.com/blog/2009/10/ipsec-vpns-for-mikrotik-routeros/#comments</comments>
		<pubDate>Wed, 21 Oct 2009 11:08:31 +0000</pubDate>
		<dc:creator>rick</dc:creator>
				<category><![CDATA[Geek]]></category>
		<category><![CDATA[ISP]]></category>
		<category><![CDATA[Mikrotik]]></category>
		<category><![CDATA[ipsec]]></category>
		<category><![CDATA[routerboard]]></category>
		<category><![CDATA[routeros]]></category>
		<category><![CDATA[vpn]]></category>
		<category><![CDATA[zywall]]></category>
		<category><![CDATA[ZyXEL]]></category>

		<guid isPermaLink="false">http://www.potato-people.com/blog/?p=70</guid>
		<description><![CDATA[It&#8217;s unfortunate that the Mikrotik RouterOS manual on IPsec is not great &#8211; it&#8217;s sorely lacking in details  and good examples, and what examples it does have are not well explained. Recently I had to setup several Mikrotik RouterOS to ZyXEL VPNs and through I would document how it&#8217;s done. First, a quick diagram to [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s unfortunate that the Mikrotik RouterOS manual on IPsec is not great &#8211; it&#8217;s sorely lacking in details  and good examples, and what examples it does have are not well explained.</p>
<p>Recently I had to setup several Mikrotik RouterOS to ZyXEL VPNs and through I would document how it&#8217;s done.</p>
<p><span id="more-70"></span></p>
<p>First, a quick diagram to explain the setup we&#8217;re going to cover. Just imagine that the 10.0.0.0/24 network in the middle is in fact the internet.</p>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-72" title="diagram" src="http://www.potato-people.com/blog/wp-content/uploads/2009/10/diagram1.png" alt="diagram" width="650" height="132" /></p>
<p>We&#8217;ll configure the ZyXEL&#8217;s &#8220;public&#8221; address as 10.0.0.1 and the RB&#8217;s as 10.0.0.2.</p>
<p>First, the ZyXEL. It&#8217;s an older ZyXEL 652H, but the same settings apply to almost all of the VPN enabled ZyXEL devices. Create the VPN as you normally would on the ZyXEL, ensuring to use subnet&#8217;s for your local and remote networks, as well the IP addressess of the ZyXEL and Mikrotik for the Peer IDs:</p>
<p style="text-align: center;"><a href="http://www.potato-people.com/blog/wp-content/uploads/2009/10/zyxel_vpn1.png"><img class="aligncenter size-full wp-image-73" title="zyxel_vpn1" src="http://www.potato-people.com/blog/wp-content/uploads/2009/10/zyxel_vpn1.png" alt="zyxel_vpn1" width="370" height="505" /></a></p>
<p style="text-align: left;">And under advanced:<a href="http://www.potato-people.com/blog/wp-content/uploads/2009/10/zyxel_vpn2.png"><img class="aligncenter size-full wp-image-74" title="zyxel_vpn2" src="http://www.potato-people.com/blog/wp-content/uploads/2009/10/zyxel_vpn2.png" alt="zyxel_vpn2" width="375" height="376" /></a></p>
<p style="text-align: left;">Now, on RouterOS we start by configuring the policy for this VPN. This is the equivelent of the first page of the ZyXEL configuration. Open the IP-&gt;IPsec window in WinBox, and create a new policy as follows:</p>
<p style="text-align: center;"><img class="size-full wp-image-75   aligncenter" title="ros_policy1" src="http://www.potato-people.com/blog/wp-content/uploads/2009/10/ros_policy1.png" alt="ros_policy1" width="313" height="295" /><img class="size-full wp-image-77 aligncenter" title="ros_policy2" src="http://www.potato-people.com/blog/wp-content/uploads/2009/10/ros_policy21.png" alt="ros_policy2" width="313" height="295" /></p>
<p style="text-align: left;">Next, switch to the &#8220;Peers&#8221; tab and create a new peer, using the public address of the ZyXEL as the address:</p>
<p style="text-align: left;"><img class="aligncenter size-full wp-image-78" title="ros_peer" src="http://www.potato-people.com/blog/wp-content/uploads/2009/10/ros_peer.png" alt="ros_peer" width="577" height="537" /></p>
<p style="text-align: left;">There&#8217;s a few confusing extras here that don&#8217;t appear on the ZyXEL.</p>
<ul>
<li>Proposal Check &#8211; Determines how proposed lifetimes are handled. Setting this to &#8220;Obey&#8221; is the most flexible as it will make RouterOS conform to whatever the remote site proposes.</li>
<li>DH Group &#8211; Mikrotik use the actual algorithm names as opposed to the normal &#8220;DH1&#8243; or &#8220;DH2&#8243;. The table below shows the mapping between these:<br />
<table border="1" cellspacing="0" cellpadding="5">
<tbody>
<tr>
<td>Diffie-Hellman Group</td>
<td>Name</td>
<td>Reference</td>
</tr>
<tr>
<td>Group 1</td>
<td>768 bit MODP group</td>
<td>RFC2409</td>
</tr>
<tr>
<td>Group 2</td>
<td>1024 bits MODP group</td>
<td>RFC2409</td>
</tr>
<tr>
<td>Group 3</td>
<td>EC2N group on GP(2^155)</td>
<td>RFC2409</td>
</tr>
<tr>
<td>Group 4</td>
<td>EC2N group on GP(2^185)</td>
<td>RFC2409</td>
</tr>
<tr>
<td>Group 5</td>
<td>1536 bits MODP group</td>
<td>RFC3526</td>
</tr>
</tbody>
</table>
<p>Note: I was not able to get group 2 to work. It results in a proposal mis-match error.</li>
<li>Generate Policy &#8211; Appears to dynamically generate the policies depending on what details have been supplied by the remote side. May be of use for dynamic VPNs.</li>
<li>Lifebytes &#8211; Session will be reconnected after X bytes have been encrypted. Best to leave this alone.</li>
<li>DPD &#8211; Mikrotik do not offer any explanation for this, other than that experiments on the official forums seem to confirm that it only appears works with other RouterOS devices.  <a href="http://www.juniper.net/techpubs/software/erx/junose61/swconfig-routing-vol1/html/ipsec-config4.html">Juniper&#8217;s documentation</a> explains that it stands for &#8220;Dead Peer Detection&#8221;.</li>
</ul>
<p>There&#8217;s one last step after this. In RouterOS, NAT is performed <em>before</em> IPsec takes place. This means that any general masquerade or 1:1 NAT rules will take place before the VPN is reached, and the now NAT&#8217;d addresses will not be directed across the VPN. To avoid this we need to add a NAT rule at the very top of the table:</p>
<p><img class="aligncenter size-full wp-image-79" title="ros_nat1" src="http://www.potato-people.com/blog/wp-content/uploads/2009/10/ros_nat1.png" alt="ros_nat1" width="623" height="217" /><img class="aligncenter size-full wp-image-80" title="ros_nat2" src="http://www.potato-people.com/blog/wp-content/uploads/2009/10/ros_nat2.png" alt="ros_nat2" width="623" height="217" /></p>
<p>By placing this rule at the top of the NAT table under IP-&gt;Firewall, when a packet is directed from the RouterOS LAN towards the VPN destination subnet, the &#8220;accept&#8221; action will cause the NAT table to stop processing, and thus never reach any other NAT rules.</p>
<p>There is no way to force RouterOS to establish the connection other than by sending traffic.It&#8217;s also important to note that v4.0 of RouterOS appears to suffer from a bug that causes the VPN to establish but not correctly route traffic across it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.potato-people.com/blog/2009/10/ipsec-vpns-for-mikrotik-routeros/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
