In this post, I’ll show you how to run your very own Free Private VPN (forever!) in the Oracle Cloud using OpenVPN. We’re going to use the pre-built OpenVPN image from the Oracle Cloud Marketplace, and much of the info in this post is also contained in the guide, but this post has enough information in it to get your VPN launched, so let’s get started.
First, you’re going to log in so head over and sign up if you have not done so yet.
Important! Wait, don’t go yet! When signing up for a free tier account, you’ll need to select a “home region” which will be the only region that you can create your free VM in. Keep in mind that your VPN will make your local connection appear as it originates from the same IP as the VPN, so choose your home region very carefully as it can not be changed later!
Launch Instance
Now head over to your friendly local terminal and SSH in with the username `openvpnas`:
ssh openvpnas@[Your Public IP] -i ~/.ssh/id_oci_demo
Note: You’ll want to point a domain name at your IP address to make life easier later on. Just add the appropriate record according to your DNS hosting provider’s normal process.
As soon as you SSH in for the first time, the OpenVPN init script will prompt you to complete the install. Much more detailed information regarding this script can be found in the guide. The prompts, as of mid-December 2020, will first ask you to read and accept the EULA. Next, answer “yes” to the question that asks if this will be the primary node:
Once you provide a few initial configuration settings,
OpenVPN Access Server can be configured by accessing
its Admin Web UI using your Web browser.
Will this be the primary Access Server node?
(enter 'no' to configure as a backup or standby node)
> Press ENTER for default [yes]: yes
Choose ‘all interfaces’:
Please specify the network interface and IP address to be
used by the Admin Web UI:
(1) all interfaces: 0.0.0.0
(2) ens3: 10.0.0.46
Please enter the option number from the list above (1-2).
> Press Enter for default [1]: 1
Accept the default port for the Admin Web UI:
Please specify the port number for the Admin Web UI.
> Press ENTER for default [943]:
Accept the default port for the Daemon:
Please specify the TCP port number for the OpenVPN Daemon
> Press ENTER for default [443]:
Accept the default (yes) for “Should client traffic be routed by default through the VPN?”:
Should client traffic be routed by default through the VPN?
> Press ENTER for default [yes]:
Accept the default for “Use local authentication” – this will mean that you have to create/manage VPN users via the Admin UI.
Use local authentication via internal DB?
> Press ENTER for default [yes]:
Accept the default for “Should private subnets be accessible…”:
Should private subnets be accessible to clients by default?
Press ENTER for default [yes]:
Accept the default Admin UI username (or specify your own name):
Do you wish to login to the Admin UI as "openvpn"?
> Press ENTER for default [yes]:
Leave the activation key blank (unless you have a key). OpenVPN is free for 2 users without a key:
> Please specify your Activation key (or leave blank to specify later):
The script will now produce output similar to the following:
Initial Configuration Complete!
You can now continue configuring OpenVPN Access Server by
directing your Web browser to this URL:
https://10.0.0.46:943/admin
Login as "openvpn" with the same password used to authenticate
to this UNIX host.
During normal operation, OpenVPN AS can be accessed via these URLs:
Admin UI: https://10.0.0.46:943/admin
Client UI: https://10.0.0.46:943/
See the Release Notes for this release at:
https://openvpn.net/vpn-server-resources/release-notes/
Next, set a Linux password for the `openvpn` user:
$ sudo passwd openvpn
The default timezone is set to US (Pacific – Los Angeles). If you would like to change this, run the following command (you will be asked what timezone you would like to set).
$ sudo dpkg-reconfigure tzdata
Login To Admin UI of Free Private VPN
Note: If you do not update this setting, NONE of your clients will be able to connect to your VPN server since by default it is set to a non-routable (private) IP address!
At this point, the internal IP address has been configured as the server name.
That will take care of the basic VPN configuration, but should you want to read more, please refer to the additional security recommendations.
Create A User
Connecting To The VPN
Download the proper OpenVPN Connect Client for your OS:
- https://openvpn.net/client-connect-vpn-for-windows/
- https://openvpn.net/client-connect-vpn-for-mac-os/
Testing The VPN
Visit this page (or something similar) both before and after connecting to your Free Private VPN. You’ll notice that your IP address and location will assume the VPN’s information and location after connecting to the VPN.
Summary
In this post, we launched our own Free Private VPN server and connected to it from our local machine. There are certainly other servers that can be used for VPN, so feel free to adapt this process as necessary. You may have to launch your own VM though instead of using a preconfigured VM image as we’ve done here.