From SME Server
Jump to: navigation, search
Warning.png Warning:
 : this contribution is obsolete. Prefer to refer towards OpenVPN_Bridge, OpenVPN_Routed, OpenVPN_SiteToSite, ... contribs of Daniel B..


This howto has been developed by Jesper Knudsen from SME Optimizer

The files needed here from the site hosting it - - are not available anymore.


OpenVPN ( is an excellent way to provide remote access to users from home or on the road. OpenVPN provides a complete replacement of the time to time unreliable PPTP VPN which is a part of the standard SME distribution. This Howto is focused on using OpenVPN in routed mode as a Windows 2k/XP/Vista Client to Server VPN connection. The installation consists of two steps, first the the portion which resides on the server and then the Client. I the following setup it is assumed that the local IP range for the private network is and that the tunneled VPN network will be

Important.png Note:
From OpenVPN website: I would recommend using routing unless you need a specific feature which requires bridging, such as:
  • the VPN needs to be able to handle non-IP protocols such as IPX,
  • you are running applications over the VPN which rely on network broadcasts (such as LAN games), or
  • you would like to allow browsing of Windows file shares across the VPN without setting up a Samba or WINS server.

Important.png Note:
OpenVPN-Bridge contribution is an alternative to this (with even a server-manager panel) but is more targeted site<->end clients configurations. See

Important.png Note:
You can also take a look at . It's an alternative, with a panel in the server-manager and is specially made to connect several SME Servers together.

Important.png Note:
You can also take a look at as another alternative, with a panel in the server-manager.

OpenVPN Server Configuration

For SME 7x, first Collect and install the rpm`s as indicated below. The RPM are taken from DAG's repository which is pretty extensive.

cd /root
mkdir openvpn
cd openvpn
rpm -Uvh *.rpm

For SME 8x, the easiest way is to get the RPM from the DAG repository.

cd /root
mkdir openvpn
cd openvpn
# (--Ddougan 20:53, 6 September 2012 (MDT))
rpm -Uvh *.rpm

Now its time to create the keys. The openvpn configs live in /etc/openvpn. First we need to edit the file with default values to match our installation. Open the file "vars" and Edit the default values to reflect your setup at the bottom of the file (KEY_COUNTRY, KEY_PROVINCE, KEY_CITY, KEY_ORG, KEY_EMAIL). Default we use 1024 bit Diffie Hellman but this can be changed to 2048 or even 4096 bit keys (depending of your paranoia level..)

cd /usr/share/doc/openvpn-2.0.9/easy-rsa
pico vars

For SME8.x

cd /usr/share/doc/openvpn-2.2.2/easy-rsa/2.0/
nano vars
chmod 744 *
chmod -R 700 keys

Now we can create the master certificate. Choose the defaults as entered into the vars file. You will need to enter values for the "Organizational Unit Name" which you can set to "VPN" and"Common Name" could be set to "Server"

source vars
sh clean-all
sh build-ca

Now we can build the certificate/private-key pairs for both the server and clients. Again choose choose "Organizational Unit Name" and "Common Name" as above. Do not add "A Challenge password" when asked, just press <ENTER>. The same goes for "An optional company name". Sign the certificate in the end.

sh build-key server

Now its time for the Client certificate which is pretty much the same as before. Use "Client" as "Common Name" and "VPN" for "Organizational Unit Name". Do not add "A Challenge password" when asked, just press <ENTER>. The same goes for "An optional company name". Sign the certificate in the end.

sh build-key client

Finally we build the Diffie Hellman parameters.

sh build-dh
Generating DH parameters, 1024 bit long safe prime, generator 2
This is going to take a long time

And it can take a long time. Your generated keys will be in /usr/share/doc/openvpn-2.0.9/easy-rsa/keys. The key names - "Server" and "Client" are simply descriptive. Choose names that suit your setup. You can create as many keys as you like using the above method. clean-all will clean out your keys directory - so be careful.

The newly generated keys needs to be copied to the the OpenVPN directory.

cp keys/ca.crt /etc/openvpn
cp keys/server.crt /etc/openvpn
cp keys/server.key /etc/openvpn
cp keys/dh1024.pem /etc/openvpn

The OpenVPN configuration along with authentication scripts file can be downloaded from my site. Download them and make the executable for root. There will be log files created in /var/log/openvpn indicating when users have logged in and out as well as login failures. Only users that have VPN Client Access enabled in Server-Manager will be allowed to VPN.

cd /etc/openvpn
mkdir -p /var/log/openvpn
tar xzf OpenVPN.tgz
chmod 755 *.pl
chmod 755 *.sh
chmod 700 *.up
rm -rf OpenVPN.tgz

Now you need to make a few changes to the /etc/openvpn/server.conf. Change the domain name listed as, ensure that the DNS server pushed to the clients is correct (dhcp-option DNS and lastly the route net pushed (route

port 1194
dev tap
dh dh1024.pem
ca ca.crt
cert server.crt
key server.key
auth-user-pass-verify ./ via-env
client-disconnect ./
up ./openvpn.up
mode server
ifconfig-pool # IP range for OpenVPN clients
tun-mtu 1500
tun-mtu-extra 32
mssfix 1450
ping 10
ping-restart 120
push "ping 10"
push "ping-restart 60"
push "dhcp-option DOMAIN"                # push the DNS domain suffix
push "dhcp-option DNS"                      # push primary DNS entry to the openvpn clients.
push "route"    # add route to to protected network
status-version 2
status openvpn-status.log
verb 3

If you are running this server is "server-gateway mode" you now need to open port 1194 for UDP traffic as this is the default tunnel for OpenVPN. Now go into the Server Manager panel under port forwarding and forward UDP/1194 to "localhost". If your server is in "server mode" you also need to fiddle with IPTables. Install the port opener and ensure to update the navigation panel. You will now have a "Port Opening" in the "Configuration" sections of the server-manager. Use it to open UDP/1194.

rpm -Uvh

You now need to add the VPN address range as a local networks in the server-manager under the Security section.

Important.png Note:
Router: IP address of the SME servers LAN net. I this example

The last thing you need to do before the installation is complete is to do a small change in the /etc/openvpn/openvpn.up file. Change the value to match router you used when adding a local network.

route del -net netmask gw
route del -net netmask dev tap0
route add -net netmask gw 

When you have changed the file to match your network we start the service.

/etc/init.d/openvpn start

Verify that the service is running correctly by issuing an "ifconfig" and see the new "tap0" device

tap0      Link encap:Ethernet  HWaddr 00:FF:A3:3C:75:18
          inet addr:  Bcast:  Mask:
          RX packets:178204868 errors:0 dropped:0 overruns:0 frame:0
          TX packets:192915252 errors:0 dropped:1880 overruns:0 carrier:0
          RX bytes:1802570258 (1719.0 Mb)  TX bytes:1338165457 (1276.1 Mb)

Now you want to ensure the the OpenVPN service starts every time you reboot your SME server.

ln -s /etc/rc.d/init.d/openvpn /etc/rc7.d/S99OpenVPN

OpenVPN Client Configuration

The Win2k/XP/Vista client installation is quite simple and pretty much only require the Windows GUI and a configuration file. The Windows GUI can be downloaded from If you run Vista you need to use the 2.1 Release Candidate (today RC9) to get it to work. Windows 2K/XP users can use the stable version

When the GUI has been installed you need to create a configuration file for your VPN tunnel. Create a file in "C:/Program Files/OpenVPN/config" called VPN.ovpn with the following content and where you change the to match your configuration.

port 1194
dev tap
ca ca.crt
cert client.crt
key client.key
tun-mtu 1500
tun-mtu-extra 32
mssfix 1450
verb 4

You now need to copy the Client keys you generated during the Server installation to the same directory on the Win2k/XP/Vista client. The following keys and certificates must be copied to the "C:/Program Files/OpenVPN/config" folder.

   * ca.crt
   * client.crt
   * client.key

The Client installation is now complete and the user will be prompted upon login for the username and passwords.


When running the OpenVPN Client on MS Vista it fails updating routes

You need to make sure you run the OpenVPN GUI as administrator. See this page on details how to do that

How can I see which users are online or failed login?

Check the logfile in /var/log/openvpn/logins to see assigned IP, failures, etc.

How do I report a problem or a suggestion?

This contrib has not yet been created in the bugtracker so just send an email to

Other articles in this category

Ipsec, Libreswan, Libreswan IPSEC, OpenVPN, OpenVPN Bridge, OpenVPN Routed, OpenVPN SiteToSite, SME Server wishlist, Smeserver-libreswan-xl2tpd, SoftEther VPN, VPN