2003-02-04 16:26:02 +01:00
|
|
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
|
|
|
<html>
|
|
|
|
|
<head>
|
2003-07-16 20:59:33 +02:00
|
|
|
|
|
2003-02-04 16:26:02 +01:00
|
|
|
|
<meta http-equiv="Content-Type"
|
|
|
|
|
content="text/html; charset=windows-1252">
|
2003-03-08 03:28:47 +01:00
|
|
|
|
<title>OpenVPN Tunnels</title>
|
2003-07-16 20:59:33 +02:00
|
|
|
|
|
2003-02-04 16:26:02 +01:00
|
|
|
|
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
|
2003-07-16 20:59:33 +02:00
|
|
|
|
|
2003-02-04 16:26:02 +01:00
|
|
|
|
<meta name="ProgId" content="FrontPage.Editor.Document">
|
|
|
|
|
</head>
|
|
|
|
|
<body>
|
2003-07-16 20:59:33 +02:00
|
|
|
|
|
2003-02-04 16:26:02 +01:00
|
|
|
|
<table border="0" cellpadding="0" cellspacing="0"
|
|
|
|
|
style="border-collapse: collapse;" bordercolor="#111111" width="100%"
|
2003-07-16 20:59:33 +02:00
|
|
|
|
id="AutoNumber1" bgcolor="#3366ff" height="90">
|
|
|
|
|
<tbody>
|
|
|
|
|
<tr>
|
|
|
|
|
<td width="100%">
|
2003-02-04 16:26:02 +01:00
|
|
|
|
<h1 align="center"><font color="#ffffff">OpenVPN Tunnels</font></h1>
|
2003-07-16 20:59:33 +02:00
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
</tbody>
|
2003-02-04 16:26:02 +01:00
|
|
|
|
</table>
|
2003-07-16 20:59:33 +02:00
|
|
|
|
|
2003-02-04 16:26:02 +01:00
|
|
|
|
<h3><br>
|
2003-07-16 20:59:33 +02:00
|
|
|
|
</h3>
|
|
|
|
|
|
|
|
|
|
<p>OpenVPN is a robust and highly configurable VPN (Virtual Private Network)
|
|
|
|
|
daemon which can be used to securely link two or more private networks using
|
|
|
|
|
an encrypted tunnel over the internet. OpenVPN is an Open Source project
|
|
|
|
|
and is <a href="http://openvpn.sourceforge.net/license.html">licensed under
|
2003-03-08 03:28:47 +01:00
|
|
|
|
the GPL</a>. OpenVPN can be downloaded from <a
|
2003-02-04 16:26:02 +01:00
|
|
|
|
href="http://openvpn.sourceforge.net/">http://openvpn.sourceforge.net/</a>.<br>
|
2003-07-16 20:59:33 +02:00
|
|
|
|
</p>
|
|
|
|
|
|
2003-02-04 16:26:02 +01:00
|
|
|
|
<p>OpenVPN support was added to Shorewall in version 1.3.14.<br>
|
2003-07-16 20:59:33 +02:00
|
|
|
|
</p>
|
|
|
|
|
|
2003-02-04 16:26:02 +01:00
|
|
|
|
<h2>Bridging two Masqueraded Networks</h2>
|
2003-07-16 20:59:33 +02:00
|
|
|
|
|
2003-02-04 16:26:02 +01:00
|
|
|
|
<p>Suppose that we have the following situation:</p>
|
2003-07-16 20:59:33 +02:00
|
|
|
|
|
2003-02-04 16:26:02 +01:00
|
|
|
|
<p align="center"><img border="0" src="images/TwoNets1.png" width="745"
|
|
|
|
|
height="427">
|
2003-07-16 20:59:33 +02:00
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
<p align="left">We want systems in the 192.168.1.0/24 subnetwork to be able
|
|
|
|
|
to communicate with the systems in the 10.0.0.0/8 network. This is accomplished
|
|
|
|
|
through use of the /etc/shorewall/tunnels file and the /etc/shorewall/policy
|
2003-03-08 03:28:47 +01:00
|
|
|
|
file and OpenVPN.</p>
|
2003-07-16 20:59:33 +02:00
|
|
|
|
|
|
|
|
|
<p align="left">While it was possible to use the Shorewall start and stop
|
|
|
|
|
script to start and stop OpenVPN, I decided to use the init script of OpenVPN
|
2003-03-08 03:28:47 +01:00
|
|
|
|
to start and stop it.</p>
|
2003-07-16 20:59:33 +02:00
|
|
|
|
|
|
|
|
|
<p align="left">On each firewall, you will need to declare a zone to represent
|
|
|
|
|
the remote subnet. We'll assume that this zone is called 'vpn' and declare
|
2003-03-08 03:28:47 +01:00
|
|
|
|
it in /etc/shorewall/zones on both systems as follows.</p>
|
2003-07-16 20:59:33 +02:00
|
|
|
|
|
|
|
|
|
<blockquote>
|
2003-02-04 16:26:02 +01:00
|
|
|
|
<table border="2" cellpadding="2" style="border-collapse: collapse;">
|
2003-07-16 20:59:33 +02:00
|
|
|
|
<tbody>
|
|
|
|
|
<tr>
|
|
|
|
|
<td><strong>ZONE</strong></td>
|
|
|
|
|
<td><strong>DISPLAY</strong></td>
|
|
|
|
|
<td><strong>COMMENTS</strong></td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td>vpn</td>
|
|
|
|
|
<td>VPN</td>
|
|
|
|
|
<td>Remote Subnet</td>
|
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
</tbody>
|
2003-02-04 16:26:02 +01:00
|
|
|
|
</table>
|
2003-07-16 20:59:33 +02:00
|
|
|
|
</blockquote>
|
|
|
|
|
|
|
|
|
|
<p align="left">On system A, the 10.0.0.0/8 will comprise the <b>vpn</b> zone.
|
|
|
|
|
In /etc/shorewall/interfaces:</p>
|
|
|
|
|
|
|
|
|
|
<blockquote>
|
2003-02-04 16:26:02 +01:00
|
|
|
|
<table border="2" cellpadding="2" style="border-collapse: collapse;">
|
2003-07-16 20:59:33 +02:00
|
|
|
|
<tbody>
|
|
|
|
|
<tr>
|
|
|
|
|
<td><b>ZONE</b></td>
|
|
|
|
|
<td><b>INTERFACE</b></td>
|
|
|
|
|
<td><b>BROADCAST</b></td>
|
|
|
|
|
<td><b>OPTIONS</b></td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td>vpn</td>
|
|
|
|
|
<td>tun0</td>
|
|
|
|
|
<td><br>
|
|
|
|
|
</td>
|
|
|
|
|
<td><EFBFBD></td>
|
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
</tbody>
|
2003-02-04 16:26:02 +01:00
|
|
|
|
</table>
|
2003-07-16 20:59:33 +02:00
|
|
|
|
</blockquote>
|
|
|
|
|
|
2003-02-04 16:26:02 +01:00
|
|
|
|
<p align="left">In /etc/shorewall/tunnels on system A, we need the following:</p>
|
2003-07-16 20:59:33 +02:00
|
|
|
|
|
|
|
|
|
<blockquote>
|
2003-02-04 16:26:02 +01:00
|
|
|
|
<table border="2" cellpadding="2" style="border-collapse: collapse;">
|
2003-07-16 20:59:33 +02:00
|
|
|
|
<tbody>
|
|
|
|
|
<tr>
|
|
|
|
|
<td><b>TYPE</b></td>
|
|
|
|
|
<td><b>ZONE</b></td>
|
|
|
|
|
<td><b>GATEWAY</b></td>
|
|
|
|
|
<td><b>GATEWAY ZONE</b></td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td>openvpn</td>
|
|
|
|
|
<td>net</td>
|
|
|
|
|
<td>134.28.54.2</td>
|
|
|
|
|
<td><EFBFBD></td>
|
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
</tbody>
|
2003-02-04 16:26:02 +01:00
|
|
|
|
</table>
|
2003-07-16 20:59:33 +02:00
|
|
|
|
</blockquote>
|
|
|
|
|
|
|
|
|
|
<p>This entry in /etc/shorewall/tunnels opens the firewall so that OpenVPN
|
|
|
|
|
traffic on the default port 5000/udp will be accepted to/from the remote
|
|
|
|
|
gateway. If you change the port used by OpenVPN to 7777, you can define<6E>/etc/shorewall/tunnels
|
2003-03-08 03:28:47 +01:00
|
|
|
|
like this:<br>
|
2003-07-16 20:59:33 +02:00
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
<blockquote>
|
2003-02-04 16:26:02 +01:00
|
|
|
|
<table border="2" cellpadding="2" style="border-collapse: collapse;">
|
2003-07-16 20:59:33 +02:00
|
|
|
|
<tbody>
|
|
|
|
|
<tr>
|
|
|
|
|
<td><b>TYPE</b></td>
|
|
|
|
|
<td><b>ZONE</b></td>
|
|
|
|
|
<td><b>GATEWAY</b></td>
|
|
|
|
|
<td><b>GATEWAY ZONE</b></td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td>openvpn:7777</td>
|
|
|
|
|
<td>net</td>
|
|
|
|
|
<td>134.28.54.2</td>
|
|
|
|
|
<td><EFBFBD></td>
|
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
</tbody>
|
2003-02-04 16:26:02 +01:00
|
|
|
|
</table>
|
2003-07-16 20:59:33 +02:00
|
|
|
|
</blockquote>
|
|
|
|
|
|
2003-02-04 16:26:02 +01:00
|
|
|
|
<p>This is the OpenVPN config on system A:</p>
|
2003-07-16 20:59:33 +02:00
|
|
|
|
|
|
|
|
|
<blockquote>
|
2003-02-04 16:26:02 +01:00
|
|
|
|
<p></p>
|
2003-07-16 20:59:33 +02:00
|
|
|
|
</blockquote>
|
|
|
|
|
|
|
|
|
|
<blockquote>
|
2003-02-04 16:26:02 +01:00
|
|
|
|
<p>dev tun<br>
|
2003-07-16 20:59:33 +02:00
|
|
|
|
local 206.162.148.9<br>
|
|
|
|
|
remote 134.28.54.2<br>
|
|
|
|
|
ifconfig 192.168.99.1 192.168.99.2<br>
|
|
|
|
|
up ./route-a.up<br>
|
|
|
|
|
tls-server<br>
|
|
|
|
|
dh dh1024.pem<br>
|
|
|
|
|
ca ca.crt<br>
|
|
|
|
|
cert my-a.crt<br>
|
|
|
|
|
key my-a.key<br>
|
|
|
|
|
comp-lzo<br>
|
|
|
|
|
verb 5<br>
|
|
|
|
|
</p>
|
|
|
|
|
</blockquote>
|
|
|
|
|
|
|
|
|
|
<p>Similarly, On system B the 192.168.1.0/24 subnet will comprise the <b>vpn</b>
|
2003-03-08 03:28:47 +01:00
|
|
|
|
zone. In /etc/shorewall/interfaces:</p>
|
2003-07-16 20:59:33 +02:00
|
|
|
|
|
|
|
|
|
<blockquote>
|
2003-02-04 16:26:02 +01:00
|
|
|
|
<table border="2" cellpadding="2" style="border-collapse: collapse;">
|
2003-07-16 20:59:33 +02:00
|
|
|
|
<tbody>
|
|
|
|
|
<tr>
|
|
|
|
|
<td><b>ZONE</b></td>
|
|
|
|
|
<td><b>INTERFACE</b></td>
|
|
|
|
|
<td><b>BROADCAST</b></td>
|
|
|
|
|
<td><b>OPTIONS</b></td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td>vpn</td>
|
|
|
|
|
<td>tun0</td>
|
|
|
|
|
<td>192.168.1.255</td>
|
|
|
|
|
<td><EFBFBD></td>
|
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
</tbody>
|
2003-02-04 16:26:02 +01:00
|
|
|
|
</table>
|
2003-07-16 20:59:33 +02:00
|
|
|
|
</blockquote>
|
|
|
|
|
|
2003-02-04 16:26:02 +01:00
|
|
|
|
<p>In /etc/shorewall/tunnels on system B, we have:</p>
|
2003-07-16 20:59:33 +02:00
|
|
|
|
|
|
|
|
|
<blockquote>
|
2003-02-04 16:26:02 +01:00
|
|
|
|
<table border="2" cellpadding="2" style="border-collapse: collapse;">
|
2003-07-16 20:59:33 +02:00
|
|
|
|
<tbody>
|
|
|
|
|
<tr>
|
|
|
|
|
<td><b>TYPE</b></td>
|
|
|
|
|
<td><b>ZONE</b></td>
|
|
|
|
|
<td><b>GATEWAY</b></td>
|
|
|
|
|
<td><b>GATEWAY ZONE</b></td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td>openvpn</td>
|
|
|
|
|
<td>net</td>
|
|
|
|
|
<td>206.191.148.9</td>
|
|
|
|
|
<td><EFBFBD></td>
|
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
</tbody>
|
2003-02-04 16:26:02 +01:00
|
|
|
|
</table>
|
2003-07-16 20:59:33 +02:00
|
|
|
|
</blockquote>
|
|
|
|
|
|
2003-02-04 16:26:02 +01:00
|
|
|
|
<p>And in the<68>OpenVPN config on system B:</p>
|
2003-07-16 20:59:33 +02:00
|
|
|
|
|
|
|
|
|
<blockquote>
|
2003-02-04 16:26:02 +01:00
|
|
|
|
<p>dev tun<br>
|
2003-07-16 20:59:33 +02:00
|
|
|
|
local 134.28.54.2<br>
|
|
|
|
|
remote 206.162.148.9<br>
|
|
|
|
|
ifconfig 192.168.99.2 192.168.99.1<br>
|
|
|
|
|
up ./route-b.up<br>
|
|
|
|
|
tls-client<br>
|
|
|
|
|
ca ca.crt<br>
|
|
|
|
|
cert my-b.crt<br>
|
|
|
|
|
key my-b.key<br>
|
|
|
|
|
comp-lzo<br>
|
|
|
|
|
verb 5<br>
|
|
|
|
|
</p>
|
|
|
|
|
</blockquote>
|
|
|
|
|
|
|
|
|
|
<p align="left">You will need to allow traffic between the "vpn" zone and
|
|
|
|
|
the "loc" zone on both systems -- if you simply want to admit all traffic
|
|
|
|
|
in both directions, you can use the policy file:</p>
|
|
|
|
|
|
|
|
|
|
<blockquote>
|
2003-02-04 16:26:02 +01:00
|
|
|
|
<table border="2" cellpadding="2" style="border-collapse: collapse;">
|
2003-07-16 20:59:33 +02:00
|
|
|
|
<tbody>
|
|
|
|
|
<tr>
|
|
|
|
|
<td><strong>SOURCE</strong></td>
|
|
|
|
|
<td><strong>DEST</strong></td>
|
|
|
|
|
<td><strong>POLICY</strong></td>
|
|
|
|
|
<td><strong>LOG LEVEL</strong></td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td>loc</td>
|
|
|
|
|
<td>vpn</td>
|
|
|
|
|
<td>ACCEPT</td>
|
|
|
|
|
<td><EFBFBD></td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td>vpn</td>
|
|
|
|
|
<td>loc</td>
|
|
|
|
|
<td>ACCEPT</td>
|
|
|
|
|
<td><EFBFBD></td>
|
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
</tbody>
|
2003-02-04 16:26:02 +01:00
|
|
|
|
</table>
|
2003-07-16 20:59:33 +02:00
|
|
|
|
</blockquote>
|
|
|
|
|
|
|
|
|
|
<p>On both systems, restart Shorewall and start OpenVPN. The systems in the
|
2003-03-08 03:28:47 +01:00
|
|
|
|
two masqueraded subnetworks can now talk to each other.</p>
|
2003-07-16 20:59:33 +02:00
|
|
|
|
|
|
|
|
|
<p><font size="2">Updated 2/4/2003 - <a href="support.htm">Tom Eastep</a></font>
|
2003-02-04 16:26:02 +01:00
|
|
|
|
<small>and Simon Mater</small><br>
|
2003-07-16 20:59:33 +02:00
|
|
|
|
</p>
|
|
|
|
|
|
2003-03-08 03:28:47 +01:00
|
|
|
|
<p><font size="2"> </font></p>
|
2003-07-16 20:59:33 +02:00
|
|
|
|
|
|
|
|
|
<p><font face="Trebuchet MS"><a href="copyright.htm"><font size="2">Copyright</font>
|
2003-03-08 03:28:47 +01:00
|
|
|
|
<20> <font size="2">2003 Thomas M. Eastep. and Simon Mater<br>
|
2003-07-16 20:59:33 +02:00
|
|
|
|
</font></a></font></p>
|
|
|
|
|
<br>
|
|
|
|
|
<br>
|
2003-03-08 03:28:47 +01:00
|
|
|
|
<br>
|
2003-02-04 16:26:02 +01:00
|
|
|
|
<br>
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|