Install OpenVPN on a NAT Server


In this guide we will cover how to install OpenVPN on a NAT based VPS.

Now we have a new NAT VPS, details listed below:

Product: LDN-128
Hypervisor: ldn6-uk
OS: CentOS 6 x64 Minimal

Hostname: ldnNATinstance
Main IP: 192.168.43.243
Shared IP: (see above)
IP Addresses Assigned: 2a06:8ec0:0000:068e:0000:0000:0000:0001

Connect to your VM and Update

Now from this we can check the external IPv4 to connect and open a SSH window.

Once SSH is open update the OS - "yum update"

yum update command

 

Enable TUN/TAP

To enable TUN/TAP login to the VPS management panel with your user details and then open the instance you wish to edit.

Management Screen


Once the main VPS page has loaded click "VPS Configuration" and then enable TUN/TAP and click submit, once the changes have been successfully applied you can close the prompt window.

VPS Configuration


Now TUN/TAP has been configured we restart the VM from the panel to ensure changes take effect.

TUN/TAP Config View


Press Stop/Start in the current control panel view.

Start/Stop VPS

Install OpenVPN

You can find nyr's OpenVPN installer which is a open source and community reputable script - https://github.com/Nyr/openvpn-install / https://git.io/vpn1604

In our case we want openVPN to listen on 24319 as this is one of our assigned ports (24300-24320) so we use the following setup:

nat-openvpn-setup-screenshot


We then enter our external/shared IPv4.

OpenVPN IP NAT Setup

 

Access OpenVPN

Now the server is configured we can access it.

Then use sFTP/SSH/rsync to download the config file.

OpenVPN NAT sFTP Download example.ovpn


Once you have downloaded the config file load it into the OpenVPN client then... Connect!

Success - Connected to OpenVPN

 

Secure Your Server

We would advise all system administrators to secure your new server once configured.

Steps such as SSH keys, configuration of firewall and general system best practices being deployed.

Additional Notes:

Ubuntu 16:
Rooban encountered issues on a Ubuntu 16 based setup with the service not starting, to fix comment LimitNProc.
Additional details at: http://askubuntu.com/questions/747023/systemd-fails-to-start-openvpn-in-lxd-managed-16-04-container 


Credits

Credit to @nyr for his script on GitHub and to Rooban for the Ubuntu 16 fix.
  • 18 Users Found This Useful
Was this answer helpful?

Related Articles

How To: SSH into a IPv4 NAT / IPv6 based VPS

1. Find the Shared IPv4See here for finding the shared/public IPv4. 2. Check your SSH forwarding...

Find your IPv4 NAT Instance Public IPv4 Address

1. Cheat SheetYour Public IPv4 Address on a NAT based instance can be found by checking your...

Enable FUSE on NAT OpenVZ

FUSE permissions can be enabled from within the management portal, select 'VPS Configuration'...

Configure VNC Server for NAT Forwarding

VNC server typically listens on 5900+ port ranges depending on the number of your display (e.g....