Jan 19, 2018

How to quickly set up your own personal VPN server with Docker


CID=$(docker run -d --privileged -p 1194:1194/udp -p 443:443/tcp jpetazzo/dockvpn)
docker run --rm -t -i -p 8080:8080 --volumes-from $CID jpetazzo/dockvpn serveconfig

OR
docker run -d --privileged  -p 443:443/tcp --name vpn cdrage/openvpn-server
docker run --rm -ti -p 8080:8080 --volumes-from vpn cdrage/openvpn-server serveconfig

Check docker is running:
$ docker ps -a
CONTAINER ID        IMAGE                      COMMAND             CREATED              STATUS              PORTS                                                    NAMES
88fdb2af8888        jpetazzo/dockvpn:latest    "/bin/sh -c run"    About a minute ago   Up About a minute   0.0.0.0:1194->1194/udp, 8080/tcp, 0.0.0.0:443->443/tcp   boring_heisenberg

To fetch the config open up a webbrowser and connect to your docker box’s IP on port 8080. You’ll likely get some security errors because this is being served over HTTPS without the correct certificates. It’s safe to ignore these errors. You can save it as “i88.ca.ovpn” or similar.

wget --no-check-certificate https://vpn.i88.ca:8080 -o i88.ca.ovpn

wget https://IP:8080/ --no-check-certificate -O config.ovpn

Or

curl -k https://localhost:8080 | tee config.ovpn


After you download the file you can stop the docker server process with control+C.

The file can be used immediately as an OpenVPN profile. It embeds all the required configuration and credentials. It has been tested successfully on Linux, Windows, Android and iPhone clients.

Connect to your VPN

You need to tell your openvpn client to use the config file you just downloaded.

On linux just run:

sudo openvpn myvpn.ovpn

On windows OpenVPN for Windows can be installed from the self-installing exe file on the OpenVPN download page.

After you've run the Windows installer, OpenVPN is ready for use and will associate itself with files having the .ovpn extension.
You may need to run it as administrator.
To run OpenVPN, you can:
  • Right click on an OpenVPN configuration file (.ovpn) and select Start OpenVPN on this configuration file. Once running, you can use the F4key to exit.
  • Run OpenVPN from a command prompt Window with a command such as:
  • openvpn myconfig.ovpn
  • Once running in a command prompt window, OpenVPN can be stopped by the F4 key.
  • Run OpenVPN as a service by putting one or more .ovpn configuration files in \Program Files\OpenVPN\config and starting the OpenVPN Service, which can be controlled from Start Menu -> Control Panel -> Administrative Tools -> Services.
This docker has been successfully set up on Google Cloud Engine of Machine type f1-micro (1 vCPU, 0.6 GB memory) and successfully connect to it from iPhone 6s.

It is also very convenient to run OpenVPN access server either on the cloud or by VM for personal use because it provides up to 2 free connections.

SoftEther VPN is also a very good option which claims to be faster than OpenVPN
Post a Comment

Featured Post

Datasets

Google Tables helps you search thousands of public Fusion Tables, or millions of public tables from around the web you can import to Fusio...