<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://ubuntuguide.org/skins/common/feed.css?207"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title>OpenVPN server - Revision history</title>
		<link>http://ubuntuguide.org/index.php?title=OpenVPN_server&amp;action=history</link>
		<description>Revision history for this page on the wiki</description>
		<language>en</language>
		<generator>MediaWiki 1.15.1</generator>
		<lastBuildDate>Sat, 25 May 2013 04:56:37 GMT</lastBuildDate>
		<item>
			<title>ScottyWZ:&amp;#32;/* Server Configuration */</title>
			<link>http://ubuntuguide.org/index.php?title=OpenVPN_server&amp;diff=28001&amp;oldid=prev</link>
			<description>&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Server Configuration&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;=== OpenVPN ===&lt;br /&gt;
One computer on a LAN can be designated as a [http://en.wikipedia.org/wiki/Virtual_private_network VPN] server to allow encrypted traffic to pass between remote clients and the computers on the LAN (through the VPN server portal). [http://openvpn.net/ OpenVPN] uses [http://en.wikipedia.org/wiki/Public_key_infrastructure Public Key Infrastructure (PKI)] certificates when establishing an encrypted [http://en.wikipedia.org/wiki/Virtual_private_network VPN] tunnel between two nodes (the server and the client).&lt;br /&gt;
&lt;br /&gt;
This hardware requirements of a dedicated VPN server depend on the number of simultaneous communication tunnels that are anticipated. A very modest computer can fulfill the needs of a VPN server if less than 10 VPN connections are anticipated. A VPN server with dozens of tunnels may benefit from greater RAM and CPU speed. Of course, the speed of the ethernet connection is the limiting factor, so robust networking cards are very important (Gigabit speeds are desirable, at least).&lt;br /&gt;
&lt;br /&gt;
==== Using a bridge interface ====&lt;br /&gt;
An OpenVPN server often uses a bridge interface. One network connection (an ethernet card, for example) connects to the WAN (Internet) through which the VPN connection is made, and a second network connection (a second ethernet card, for example) connects to the LAN. The traffic between these two connections is &amp;quot;bridged.&amp;quot; See [[Ubuntu:Jaunty#Network_Interfaces_Bridging|Network Interface Bridging]] for more details.&lt;br /&gt;
&lt;br /&gt;
==== OpenVPN Server Installation ====&lt;br /&gt;
*Install OpenVPN:&lt;br /&gt;
 sudo apt-get install openvpn&lt;br /&gt;
&lt;br /&gt;
==== Server certificates ====&lt;br /&gt;
*Create the OpenVPN server certificates.&lt;br /&gt;
:*Copy the easy-rsa directory to /etc/openvpn. This will ensure that any changes to the scripts will not be lost when the package is updated.&lt;br /&gt;
&lt;br /&gt;
 sudo mkdir /etc/openvpn/easy-rsa/&lt;br /&gt;
 sudo cp -r /usr/share/doc/openvpn/examples/easy-rsa/2.0/ /etc/openvpn/&lt;br /&gt;
&lt;br /&gt;
:*Edit /etc/openvpn/easy-rsa/vars and adjust the variables for your environment:&lt;br /&gt;
&lt;br /&gt;
 export KEY_COUNTRY=&amp;quot;US&amp;quot;&lt;br /&gt;
 export KEY_PROVINCE=&amp;quot;CA&amp;quot;&lt;br /&gt;
 export KEY_CITY=&amp;quot;''MyCity''&amp;quot;&lt;br /&gt;
 export KEY_ORG=&amp;quot;''MyCompany''&amp;quot;&lt;br /&gt;
 export KEY_EMAIL=&amp;quot;''webmaster@mycompany.com''&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:*Run the scripts to create the server certificates:&lt;br /&gt;
&lt;br /&gt;
 cd /etc/openvpn/easy-rsa/easy-rsa&lt;br /&gt;
 source vars&lt;br /&gt;
 ./clean-all&lt;br /&gt;
 ./build-dh&lt;br /&gt;
 ./pkitool --initca&lt;br /&gt;
 ./pkitool --server server&lt;br /&gt;
 cd keys&lt;br /&gt;
 openvpn --genkey --secret ta.key&lt;br /&gt;
 sudo cp server.crt server.key ca.crt dh1024.pem ta.key /etc/openvpn/&lt;br /&gt;
&lt;br /&gt;
==== Client Certificates ====&lt;br /&gt;
*A VPN clients requires a certificate in order to authenticate itself to the VPN server.&lt;br /&gt;
*Create the certificate:&lt;br /&gt;
&lt;br /&gt;
 cd /etc/openvpn/easy-rsa/&lt;br /&gt;
 source vars&lt;br /&gt;
 ./pkitool ''hostname''&lt;br /&gt;
&lt;br /&gt;
:Note: Replace ''hostname'' with the actual hostname of the client machine that will be connecting to the VPN.&lt;br /&gt;
&lt;br /&gt;
*Copy the certificate files that have been created to the client:&lt;br /&gt;
:* /etc/openvpn/easy-rsa/''hostname''.ovpn&lt;br /&gt;
:* /etc/openvpn/easy-rsa/ca.crt&lt;br /&gt;
:* /etc/openvpn/easy-rsa/''hostname''.crt&lt;br /&gt;
:* /etc/openvpn/easy-rsa/''hostname''.key&lt;br /&gt;
:* /etc/openvpn/easy-rsa/ta.key&lt;br /&gt;
&lt;br /&gt;
:Note: Use the files that correspond to your client machine's ''hostname''.&lt;br /&gt;
&lt;br /&gt;
==== Server Configuration ====&lt;br /&gt;
&lt;br /&gt;
*On the OpenVPN server, modify /etc/openvpn/server.conf from the example file: &lt;br /&gt;
&lt;br /&gt;
 sudo cp /usr/share/doc/openvpn/examples/sample-config-files/server.conf.gz /etc/openvpn/&lt;br /&gt;
 sudo gzip -d /etc/openvpn/server.conf.gz&lt;br /&gt;
&lt;br /&gt;
*Edit etc/openvpn/server.conf:&lt;br /&gt;
 sudo nano /etc/openvpn/server.conf&lt;br /&gt;
&lt;br /&gt;
:*Changing the following options to resemble:&lt;br /&gt;
&lt;br /&gt;
 local 172.18.100.101&lt;br /&gt;
 dev tap0&lt;br /&gt;
 server-bridge 172.18.100.101 255.255.255.0 172.18.100.105 172.18.100.200&lt;br /&gt;
 push &amp;quot;route 172.18.100.0 255.255.255.0&amp;quot;&lt;br /&gt;
 push &amp;quot;dhcp-option DNS 172.18.100.20&amp;quot;&lt;br /&gt;
 push &amp;quot;dhcp-option DOMAIN example.com&amp;quot;&lt;br /&gt;
 tls-auth ta.key 0 # This file is secret&lt;br /&gt;
 user nobody&lt;br /&gt;
 group nogroup&lt;br /&gt;
&lt;br /&gt;
:Notes:&lt;br /&gt;
::local: is the IP address of the bridge interface.&lt;br /&gt;
::server-bridge: needed when the configuration uses bridging. The 172.18.100.101 255.255.255.0 portion is the bridge interface and mask. The IP range 172.18.100.105 172.18.100.200 is the range of IP addresses that will be assigned to clients.&lt;br /&gt;
::push: directives to add networking options for clients.&lt;br /&gt;
::user and group: configure which user and group the openvpn daemon executes as.&lt;br /&gt;
::Replace all IP addresses and domain names above with those of your network.&lt;br /&gt;
&lt;br /&gt;
*Create helper scripts to add the tap interface to the bridge.&lt;br /&gt;
:* Create /etc/openvpn/up.sh:&lt;br /&gt;
 sudo nano /etc/openvpn/up.sh&lt;br /&gt;
&lt;br /&gt;
::Add the lines:&lt;br /&gt;
&lt;br /&gt;
 #!/bin/sh&lt;br /&gt;
 #&lt;br /&gt;
 BR=$1&lt;br /&gt;
 DEV=$2&lt;br /&gt;
 MTU=$3&lt;br /&gt;
 /sbin/ifconfig $DEV mtu $MTU promisc up&lt;br /&gt;
 /usr/sbin/brctl addif $BR $DEV&lt;br /&gt;
&lt;br /&gt;
:*Create /etc/openvpn/down.sh:&lt;br /&gt;
 sudo nano /etc/openvpn/down.sh&lt;br /&gt;
&lt;br /&gt;
::Add the lines:&lt;br /&gt;
&lt;br /&gt;
 #!/bin/sh&lt;br /&gt;
 #&lt;br /&gt;
 BR=$1&lt;br /&gt;
 DEV=$2&lt;br /&gt;
 #&lt;br /&gt;
 /usr/sbin/brctl delif $BR $DEV&lt;br /&gt;
 /sbin/ifconfig $DEV down&lt;br /&gt;
&lt;br /&gt;
:*Make the scripts executable:&lt;br /&gt;
 sudo chmod 755 /etc/openvpn/down.sh&lt;br /&gt;
 sudo chmod 755 /etc/openvpn/up.sh&lt;br /&gt;
&lt;br /&gt;
:*Restart OpenVpn:&lt;br /&gt;
 sudo /etc/init.d/openvpn restart&lt;br /&gt;
&lt;br /&gt;
==== Client Configuration ====&lt;br /&gt;
*Copy the example client configuration file:&lt;br /&gt;
sudo cp /usr/share/doc/openvpn/examples/sample-config-files/client.conf /etc/openvpn&lt;br /&gt;
&lt;br /&gt;
*Edit the client configuration file:&lt;br /&gt;
 sudo nano /etc/openvpn/client.conf &lt;br /&gt;
&lt;br /&gt;
:*Change it to resemble:&lt;br /&gt;
&lt;br /&gt;
 dev tap&lt;br /&gt;
 remote ''vpn.mycompany.com'' 1194&lt;br /&gt;
 cert ''hostname''.crt&lt;br /&gt;
 key ''hostname''.key&lt;br /&gt;
 tls-auth ta.key 1&lt;br /&gt;
&lt;br /&gt;
:Note: Replace ''vpn.mycompany.com'' with the hostname of your VPN server, and ''hostname''.* with the actual certificate and key filenames that correspond to the client.&lt;br /&gt;
&lt;br /&gt;
*Restart OpenVpn:&lt;br /&gt;
 sudo /etc/init.d/openvpn restart&lt;br /&gt;
&lt;br /&gt;
*Connect the VPN client to the remote LAN through the OpenVPN server.&lt;br /&gt;
&lt;br /&gt;
==== Other resources ====&lt;br /&gt;
* [https://help.ubuntu.com/9.10/serverguide/C/openvpn.html Ubuntu 9.10 Server Guide (Karmic Koala) -- OpenVPN server]&lt;/div&gt;</description>
			<pubDate>Sun, 21 Aug 2011 20:49:01 GMT</pubDate>			<dc:creator>ScottyWZ</dc:creator>			<comments>http://ubuntuguide.org/wiki/Talk:OpenVPN_server</comments>		</item>
	</channel>
</rss>