How to setup a VPN server with OpenVPN
OpenVPN is one of the mostly used VPN solutions and the leading open source VPN. Using SSL it allows to create VPN tunnels to encrypt all the traffic going in. Today let’s take a look at how to install and set up a OpenVPN server.
The first step is to install OpenVPN:
Set up the Certificate Authority
In this step you will set up a Certificate Authority, a piece of software that you trust to sign certificates. If you already have a CA in your setup you can skip this step and should use the documentation associated with your CA to emit/revoke certificates.
Set up the Server certificate and the OpenVPN server
The first certificate you will issue will be the one associated with the OpenVPN server. This will make sure your clients will be connected to the RIGHT server rather than an imposter.
Setting up network and OpenVPN service
Allow IP Forwarding
In order to be able to route network packets, your Linux kernel must be instructed to do so:
Open firewall ports
In order for the OpenVPN traffic to pass you will need to open ports within your firewall. Change the following commands according to your port/protocol specified in the server.conf file:
Setting up masquerading
Starting and enabling OpenVPN at boot
Generating client certificates
You can simply generate client certificates (that you will use to connect from other devices) by doing: