≡ Menu

How To Setup OpenVPN Server In 5 Minutes on Ubuntu Server

I am a new Ubuntu Linux server user. How do I setup an OpenVPN Server on Ubuntu Linux version 14.04 or 16.04 LTS server to shield my browsing activity from bad guys on public Wi-Fi, and more?

OpenVPN is a full-featured SSL VPN (virtual private network). It implements OSI layer 2 or 3 secure network extension using the SSL/TLS protocol. It is an open source software and distributed under the GNU GPL. A VPN allows you to connect securely to an insecure public network such as wifi network at the airport or hotel. VPN is also required to access your corporate or enterprise or home server resources. You can bypass geo-blocked site and increase your privacy or safety online.

This tutorial provides step-by-step instructions for configuring an OpenVPN “road warrior” server on Ubuntu Linux v14.04/16.04 LTS version including ufw/iptables firewall configuration. The steps are as follows:

  1. Find and note down your public IP address
  2. Download openvpn-install.sh script
  3. Run openvpn-install.sh to install OpenVPN server
  4. Connect an OpenVPN server using IOS/Android/Linux/Windows client
  5. Verify your connectivity

Find your public IP address

Use any one of the following command to find out your IPv4 public address. If your internface name is eth0 or eth1, enter:
$ ip addr show eth0
OR
$ ip addr show eth1
Or use the host command or dig command as follows:
$ host myip.opendns.com resolver1.opendns.com
OR
$ dig TXT +short o-o.myaddr.l.google.com @ns1.google.com
Sample outputs:

Fig.01: Find out your public IPv4 address using the CLI

Fig.01: Find out your public IPv4 address using the CLI


Note down the public IP address 139.59.1.155 i.e. public ip address of your OpenVPN server.

Download openvpn-install.sh script

Type the following command:
$ wget https://git.io/vpn -O openvpn-install.sh
Sample outputs:

--2016-06-27 07:30:25--  https://git.io/vpn
Resolving git.io (git.io)... 23.23.173.104, 54.243.161.116, 23.23.111.66
Connecting to git.io (git.io)|23.23.173.104|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://raw.github.com/Nyr/openvpn-install/master/openvpn-install.sh [following]
--2016-06-27 07:30:26--  https://raw.github.com/Nyr/openvpn-install/master/openvpn-install.sh
Resolving raw.github.com (raw.github.com)... 151.101.100.133
Connecting to raw.github.com (raw.github.com)|151.101.100.133|:443... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://raw.githubusercontent.com/Nyr/openvpn-install/master/openvpn-install.sh [following]
--2016-06-27 07:30:27--  https://raw.githubusercontent.com/Nyr/openvpn-install/master/openvpn-install.sh
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.100.133
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.100.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 13340 (13K) [text/plain]
Saving to: ‘openvpn-install.sh’
 
openvpn-install.sh            100%[==============================================>]  13.03K  80.9KB/s    in 0.2s    
 
2016-06-27 07:30:28 (80.9 KB/s) - ‘openvpn-install.sh’ saved [13340/13340]

Run openvpn-install.sh to install OpenVPN server

Type the following command:
$ sudo bash openvpn-install.sh
When prompted set IP address to 139.59.1.155 and Port to 1194. Use Google or OpenDNS DNS servers with the vpn. Next, type client name (such as iPhone, Nexus6, LinuxRouter etc). Finally, press [Enter] key to install and setup OpenVPN on your system:

Fig.02: Setting up OpenVPN server on an Ubuntu Linux server v16.04 LTS

Fig.02: Setting up OpenVPN server on an Ubuntu Linux server v16.04 LTS


The script will now generate keys, DH parameters and more as follows:

Okay, that was all I needed. We are ready to setup your OpenVPN server now
Press any key to continue...
Get:1 http://security.ubuntu.com 
......
...
..
--2016-06-27 17:10:38--  https://github.com/OpenVPN/easy-rsa/releases/download/3.0.1/EasyRSA-3.0.1.tgz
Resolving github.com (github.com)... 192.30.252.120
Connecting to github.com (github.com)|192.30.252.120|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://github-cloud.s3.amazonaws.com/releases/4519663/9dab10e8-7b6a-11e5-91af-0660987e9192.tgz?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAISTNZFOVBIJMK3TQ%2F20160627%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20160627T114040Z&X-Amz-Expires=300&X-Amz-Signature=717ae4f606d1999b4c7c164ae06d163c494197f04aafffa9f760a8e0bf136136&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3B%20filename%3DEasyRSA-3.0.1.tgz&response-content-type=application%2Foctet-stream [following]
--2016-06-27 17:10:40--  https://github-cloud.s3.amazonaws.com/releases/4519663/9dab10e8-7b6a-11e5-91af-0660987e9192.tgz?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAISTNZFOVBIJMK3TQ%2F20160627%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20160627T114040Z&X-Amz-Expires=300&X-Amz-Signature=717ae4f606d1999b4c7c164ae06d163c494197f04aafffa9f760a8e0bf136136&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3B%20filename%3DEasyRSA-3.0.1.tgz&response-content-type=application%2Foctet-stream
Resolving github-cloud.s3.amazonaws.com (github-cloud.s3.amazonaws.com)... 54.231.72.3
Connecting to github-cloud.s3.amazonaws.com (github-cloud.s3.amazonaws.com)|54.231.72.3|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 40960 (40K) [application/octet-stream]
Saving to: ‘/root/EasyRSA-3.0.1.tgz’
 
/root/EasyRSA-3.0.1.tgz       100%[================================================>]  40.00K  38.8KB/s   in 1.0s   
 
2016-06-27 17:10:43 (38.8 KB/s) - ‘/root/EasyRSA-3.0.1.tgz’ saved [40960/40960]
 
 
init-pki complete; you may now create a CA or requests.
Your newly created PKI dir is: /etc/openvpn/easy-rsa/pki
Generating a 2048 bit RSA private key
........+++
...............................................................................................+++
writing new private key to '/etc/openvpn/easy-rsa/pki/private/ca.key.BjRh5frdDd'
-----
Generating DH parameters, 2048 bit long safe prime, generator 2
This is going to take a long time
....+.....+................................................................................+..................................................................................................................................................................+......................................
...
..
.................................................................................................................+........................................................................................................................................+.................................+......................................................+...++*++*
 
DH parameters of size 2048 created at /etc/openvpn/easy-rsa/pki/dh.pem
 
Generating a 2048 bit RSA private key
.......................................................................+++
..................................................+++
writing new private key to '/etc/openvpn/easy-rsa/pki/private/server.key.9ieuluTC2R'
-----
Using configuration from /etc/openvpn/easy-rsa/openssl-1.0.cnf
Check that the request matches the signature
Signature ok
The Subject's Distinguished Name is as follows
commonName            :ASN.1 12:'server'
Certificate is to be certified until Jun 25 11:55:48 2026 GMT (3650 days)
 
Write out database with 1 new entries
Data Base Updated
Generating a 2048 bit RSA private key
.........+++
.........+++
writing new private key to '/etc/openvpn/easy-rsa/pki/private/iphone.key.lokNfOiobc'
-----
Using configuration from /etc/openvpn/easy-rsa/openssl-1.0.cnf
Check that the request matches the signature
Signature ok
The Subject's Distinguished Name is as follows
commonName            :ASN.1 12:'iphone'
Certificate is to be certified until Jun 25 11:55:48 2026 GMT (3650 days)
 
Write out database with 1 new entries
Data Base Updated
Using configuration from /etc/openvpn/easy-rsa/openssl-1.0.cnf
 
An updated CRL has been created.
CRL file: /etc/openvpn/easy-rsa/pki/crl.pem
 
244
 
Looks like your server is behind a NAT!
 
If your server is NATed (e.g. LowEndSpirit), I need to know the external IP
If that's not the case, just ignore this and leave the next field blank
External IP:

That is all. Your OpenVPN server has been configured and ready to use. You can see added firewall rules /etc/rc.local file:
$ cat /etc/rc.local
Sample outputs:

iptables -I FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -I FORWARD -s 10.8.0.0/24 -j ACCEPT
iptables -I INPUT -p udp --dport 1194 -j ACCEPT
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -j SNAT --to 139.59.1.155

You can view your openvpn server config file generated by the script as follows (do not edit this file by hand):
$ sudo more /etc/openvpn/server.conf
$ sudo vi /etc/openvpn/server.conf

Sample outputs:

port 1194
proto udp
dev tun
sndbuf 0
rcvbuf 0
ca ca.crt
cert server.crt
key server.key
dh dh.pem
tls-auth ta.key 0
topology subnet
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "redirect-gateway def1 bypass-dhcp"
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"
keepalive 10 120
cipher AES-128-CBC
comp-lzo
user nobody
group nogroup
persist-key
persist-tun
status openvpn-status.log
verb 3
crl-verify crl.pem

How do I start/stop/restart OpenVPN server on Ubuntu Linux 16.04 LTS?

Type the following command stop the OpenVPN service:
$ sudo systemctl stop openvpn@server
Type the following command start the OpenVPN service:
$ sudo systemctl start openvpn@server
Type the following command restart the OpenVPN service:
$ sudo systemctl restart openvpn@server

How do I start/stop/restart OpenVPN server on Ubuntu Linux 14.04 LTS?

Type the following command stop the OpenVPN service:
$ sudo /etc/init.d/openvpn stop
Type the following command start the OpenVPN service:
$ sudo /etc/init.d/openvpn start
Type the following command restart the OpenVPN service:
$ sudo /etc/init.d/openvpn restart

{Optional} How to configure and use the ufw firewall rules for the OpenVPN server

The default rules added to the /etc/rc.local file should work out of the box. However, if you have complicated firewall settings or prefer ufw to control all firewall settings on Ubuntu Linux server, try the following. First, edit the /etc/rc.local file using a text editor and comment out all firewall rules added by the script. Type the following ufw command to open port 1194 and 22 (ssh):
$ sudo ufw allow 1194/udp
$ sudo ufw allow 22/tcp

Edit the file /etc/ufw/before.rules, enter:
$ sudo vi /etc/ufw/before.rules
At top of the file add the following rules:

# START OPENVPN RULES by vg
# NAT table rules
*nat
:POSTROUTING ACCEPT [0:0]
#****************************************[README]*****************************************************#
# Allow traffic from OpenVPN client to 139.59.1.155. Replace 139.59.1.155 with your actual IP address*#
#****************************************[README]*****************************************************#
-A POSTROUTING -s 10.8.0.0/24 -j SNAT --to-source  139.59.1.155
COMMIT
# END OPENVPN RULES by vg

Next scroll down and find the comment that read s follows

# ok icmp code for FORWARD

Append the following rules:

#OpenVPN Forward by vg
-A ufw-before-forward -m state --state RELATED,ESTABLISHED -j ACCEPT
-A ufw-before-forward -s 10.8.0.0/24 -j ACCEPT
-A ufw-before-forward -i tun+ -j ACCEPT
-A ufw-before-forward -i tap+ -j ACCEPT
#OpenVPN END by vg

Save and close the file. Next edit the /etc/ufw/sysctl.conf file, enter:
$ sudo vi /etc/ufw/sysctl.conf
Find and uncomment the following line to allow this host to route packets between interfaces
net/ipv4/ip_forward=1
Save and close the file. Enable ufw or reload if already running:
$ sudo ufw enable
OR
$ sudo ufw reload
Verify new firewall rules:
$ sudo ufw status
$ sudo iptables -t nat -L -n -v
$ sudo iptables -L FORWARD -n -v
$ sudo iptables -L ufw-before-forward -n -v

Client configuration

On server your will find a client configuration file called ~/iphone.ovpn. All you have to do is copy this file to your local desktop using the scp and provide this file to your OpenVPN client to connect:
$ scp vivek@139.59.1.155:~/iphone.ovpn .
Next, you need to download OpenVPN client as per your operating system:

MacOS/OS X OpenVPN client configuration

Just double click on iphone.ovpn file and it will open in your tunnelblick client > Click on the “Only me” to install it.

Fig.03: MacOS / OS X openvpn client configuration

Fig.03: MacOS / OS X openvpn client configuration


Once installed click on Connect button and you will be online. Use the following command on MacOS client to verify that your public IP changed to the VPN server IP:
$ dig TXT +short o-o.myaddr.l.google.com @ns1.google.com
You can ping to OpenVPN server private IP:
$ ping 10.8.0.1

Linux OpenVPN client configuration

First, install the openvpn client, enter:
$ sudo yum install openvpn
OR
$ sudo apt install openvpn
Next, copy iphone.ovpn as follows:
$ sudo cp iphone.ovpn /etc/openvpn/client.conf
Test connectivity from the CLI:
$ sudo openvpn --client --config /etc/openvpn/client.conf
Your Linux system will automatically connect when computer restart using /etc/init.d/openvpn script:
$ sudo /etc/init.d/openvpn start
For systemd based system, use the following command:
$ sudo systemctl start openvpn@client
Test the connectivity:
$ ping 10.8.0.1 #Ping to OpenVPN server gateway
$ ip route #Make sure routing setup
$ dig TXT +short o-o.myaddr.l.google.com @ns1.google.com #Make sure your public IP set to OpenVPN server

FreeBSD OpenVPN client configuration

First, install the openvpn client, enter:
$ sudo pkg install openvpn
Next, copy iphone.ovpn as follows:
$ mkdir -p /usr/local/etc/openvpn/
$ sudo cp iphone.ovpn /usr/local/etc/openvpn/client.conf

Edit /etc/rc.conf and add the following:

openvpn_enable="YES"
openvpn_configfile="/usr/local/etc/openvpn/client.conf"

Start the OpenVPN service:
$ sudo /usr/local/etc/rc.d/openvpn start
Verify it:
$ ping 10.8.0.1 #Ping to OpenVPN server gateway
$
$ ip route #Make sure routing setup
$
$ dig TXT +short o-o.myaddr.l.google.com @ns1.google.com #Make sure your public IP set to OpenVPN server

References

And there you have it, OpenVPN server installed in five minutes to increase your privacy.

Share this tutorial on:

Your support makes a big difference:
I have a small favor to ask. More people are reading the nixCraft. Many of you block advertising which is your right, and advertising revenues are not sufficient to cover my operating costs. So you can see why I need to ask for your help. The nixCraft, takes a lot of my time and hard work to produce. If you use nixCraft, who likes it, helps me with donations:
Become a Supporter →    Make a contribution via Paypal/Bitcoin →   

Don't Miss Any Linux and Unix Tips

Get nixCraft in your inbox. It's free:



{ 32 comments… add one }
  • MacTom June 27, 2016, 1:28 pm

    5 minutes? It takes more time for sure. Where are keys.

  • Alexander Alekseev June 27, 2016, 2:02 pm

    Doesn’t look like 5 minutes to me and in fact it’s much, much simpler. Here is my cheat sheet (in Russian) http://eax.me/openvpn/ – this way it actually takes 5 minutes, I’ve checked many times.

  • Raju T June 27, 2016, 6:10 pm

    Can we see a CentOS 7 version of this tutorial?
    Cheers.

  • Matteo Trentin June 27, 2016, 9:23 pm

    And… how to temporarily suspend a client?
    no easy guide outsider there.
    thx

  • jesusguevarautomotriz June 28, 2016, 3:33 am

    Hey, what a great article you’ve written, has long sought something like this, I have many articles and information gathered on the subject of Open VPN for when it is their time to implement exactly what you suggest in this article, that just what I need, nothing more.

    The option to download the article in pdf format of this blog is superior and much needed, although I use Pocket to store many items is very comfortable to save it to disk in a nicely formatted pdf.

    Can you make the option “Download to PDF” print the comments and related posts? your blog provides highly valuable information and deserves this option.

    A fan, Thanks.

    • Vivek Gite June 28, 2016, 10:49 am

      Thanks for the feedback. It required too much programming or changes to include the comments and related post in pdf file. I can’t promise anything but I will look into it when I’ve some free time.

  • Ben Gillam June 28, 2016, 8:38 am

    Nice guide, how about adding users as this only shows the one user during setup

  • jesusguevarautomotriz July 4, 2016, 7:20 am

    First a brief note:
    sudo openvpn-install.sh I not work for me
    Openvpn-install.sh bash had to do to make it work.

    Hi, I’m trying to do this in a Lubuntu 14.04 LTS 2007 MacBook Laptop connected to a WiFi network, is this possible? I know you specify that is a Ubuntu Server.

    The script ran successfully, but the first step in where he had to enter the IP address, showed the local network address 192.168.0.25 and change it to the public IP address that showed me the command: dig + short myip \. opendns.com @ resolver1.opendns.com

    When I try to connect another Asus Linux Client Lubuntu 14.04, I note that your public IP address Unchanging remains in

    Here is some of the output produced by my client:
    Mon 4 July 2016 3:10:25 SIGUSR1 [soft, tls-error] received, process restarting
    Mon 4 July 2016 3:10:25 Restart pause, 2 second (s)
    Mon 4 July 2016 3:10:27 Socket Buffers: R = [212992-> 212992] S = [212992-> 212992]
    3:10:27 Mon 4 July 2016 Local UDPv4 link: [undef]
    Mon 4 July 2016 3:10:27 UDPv4 link remote: [AF_INET] 82.250.240.108:1194
    3:11:27 Mon 4 July 2016 TLS Error: TLS key negotiation failed to Occur Within 60 seconds (check your network connectivity)
    3:11:27 Mon 4 July 2016 TLS Error: TLS handshake failed
    Mon 4 July 2016 3:11:27 SIGUSR1 [soft, tls-error] received, process restarting
    Mon 4 July 2016 3:11:27 Restart pause, 2 second (s)
    Mon 4 July 2016 3:11:29 Socket Buffers: R = [212992-> 212992] S = [212992-> 212992]
    3:11:29 Mon 4 July 2016 Local UDPv4 link: [undef]
    Mon 4 July 2016 3:11:29 UDPv4 link remote: [AF_INET] 82.250.240.108:1194
    3:12:29 Mon 4 July 2016 TLS Error: TLS key negotiation failed to Occur Within 60 seconds (check your network connectivity)
    3:12:29 Mon 4 July 2016 TLS Error: TLS handshake failed
    Mon 4 July 2016 3:12:29 SIGUSR1 [soft, tls-error] received, process restarting
    Mon 4 July 2016 3:12:29 Restart pause, 2 second (s)
    Mon 4 July 2016 3:12:31 Socket Buffers: R = [212992-> 212992] S = [212992-> 212992]
    3:12:31 Mon 4 July 2016 Local UDPv4 link: [undef]
    Mon 4 July 2016 3:12:31 UDPv4 link remote: [AF_INET] 82.250.240.108:1194

    My goal is to assemble an experimental home domestic vpn, web traffic to route and connect via ssh as if it were a LAN network to Backups or systems management work.
    Thanks greetings.

  • jesusguevarautomotriz July 4, 2016, 3:42 pm

    Sorry for the hasty and mistranslation, at the beginning I meant:

    First a brief note:
    $ sudo openvpn-install.sh I not work for me
    $ bash openvpn-install.sh had to do to make it work

  • jesusguevarautomotriz July 4, 2016, 11:55 pm
    +----------------+
      (public IP)        |                      |
      {INTERNET}={ Router          |
                                |                      |
                                |                       |
                               +------+---------+
                                          | (192.168.0.1)
                                          |
                                          |   +------------------+
                                          |   |                        |
                                          |   |  OpenVPN    |  wlan0: 192.168.0.10/24
                                         +--{wlan0 server |  tun0: 10.8.0.1/24
                                          I   |                        |
                                          |   | {tun0}             |
                                          I  +--------+---------+
                                          |
                      +------------+-----------+
                      |                                  |
                      |  Other LAN clients |
                      |                                  |
                      |   192.168.0.0/24    |
                      |      (internal net)     |
                    +---------------------------+
    
  • geeknik July 24, 2016, 7:57 am

    AES-128? Replace that with AES-256.

  • john September 5, 2016, 9:35 am

    hi. amazing tutorial. it took me less than 5 minutes in my server (192.168.1.1/24). now all remote clients(10.8.0.0/24) can easily access the server. i would like to have all the remote clients to be able to see the rest of the LAN where the server is (192.168.1.0/24). The server is ubuntu

    • justin September 17, 2016, 3:31 am

      I’m working on trying to configure that same setup now. From what I understand is you need to bridge the two networks under one subnet. Still not sure how to do that.

      • Achal November 22, 2016, 11:04 am

        can you please also help me to resolve this issue? my scenario is like:

        Public IP of VPN server: xxx.xxx.xxx.xxx
        LAN IP of VPN server: 10.0.0.XXX
        Clients are getting IP: 10.8.0.XXX

        I want my client to connect all LAN network.

        all help is appreciated in advance

  • Ingo September 22, 2016, 10:08 am

    Excellent Tutorial – Thanks !!!

  • Mohamed October 6, 2016, 1:30 pm

    this tutorial does not worked for me: the following is the log of my openvpn client:

    Thu Oct 06 15:26:41 2016 OpenVPN 2.3.12 x86_64-w64-mingw32 [SSL (OpenSSL)] [LZO] [PKCS11] [IPv6] built on Oct  3 2016
    Thu Oct 06 15:26:41 2016 Windows version 6.2 (Windows 8 or greater) 64bit
    Thu Oct 06 15:26:41 2016 library versions: OpenSSL 1.0.1u  22 Sep 2016, LZO 2.09
    Enter Management Password:
    Thu Oct 06 15:26:41 2016 MANAGEMENT: TCP Socket listening on [AF_INET]127.0.0.1:25341
    Thu Oct 06 15:26:41 2016 Need hold release from management interface, waiting...
    Thu Oct 06 15:26:41 2016 MANAGEMENT: Client connected from [AF_INET]127.0.0.1:25341
    Thu Oct 06 15:26:41 2016 MANAGEMENT: CMD 'state on'
    Thu Oct 06 15:26:41 2016 MANAGEMENT: CMD 'log all on'
    Thu Oct 06 15:26:41 2016 MANAGEMENT: CMD 'hold off'
    Thu Oct 06 15:26:41 2016 MANAGEMENT: CMD 'hold release'
    Thu Oct 06 15:26:41 2016 Control Channel Authentication: tls-auth using INLINE static key file
    Thu Oct 06 15:26:41 2016 Outgoing Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
    Thu Oct 06 15:26:41 2016 Incoming Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
    Thu Oct 06 15:26:41 2016 Socket Buffers: R=[65536->65536] S=[65536->65536]
    Thu Oct 06 15:26:41 2016 UDPv4 link local: [undef]
    Thu Oct 06 15:26:41 2016 UDPv4 link remote: [AF_INET]52.59.243.92:1194
    Thu Oct 06 15:26:41 2016 MANAGEMENT: >STATE:1475760401,WAIT,,,
    Thu Oct 06 15:27:41 2016 TLS Error: TLS key negotiation failed to occur within 60 seconds (check your network connectivity)
    Thu Oct 06 15:27:41 2016 TLS Error: TLS handshake failed
    Thu Oct 06 15:27:41 2016 SIGUSR1[soft,tls-error] received, process restarting
    Thu Oct 06 15:27:41 2016 MANAGEMENT: >STATE:1475760461,RECONNECTING,tls-error,,
    Thu Oct 06 15:27:41 2016 Restart pause, 2 second(s)
    Thu Oct 06 15:27:43 2016 Socket Buffers: R=[65536->65536] S=[65536->65536]
    Thu Oct 06 15:27:43 2016 UDPv4 link local: [undef]
    Thu Oct 06 15:27:43 2016 UDPv4 link remote: [AF_INET]52.59.243.92:1194
    Thu Oct 06 15:27:43 2016 MANAGEMENT: >STATE:1475760463,WAIT,,,
    Thu Oct 06 15:28:43 2016 TLS Error: TLS key negotiation failed to occur within 60 seconds (check your network connectivity)
    Thu Oct 06 15:28:43 2016 TLS Error: TLS handshake failed
    Thu Oct 06 15:28:43 2016 SIGUSR1[soft,tls-error] received, process restarting
    Thu Oct 06 15:28:43 2016 MANAGEMENT: >STATE:1475760523,RECONNECTING,tls-error,,
    Thu Oct 06 15:28:43 2016 Restart pause, 2 second(s)
    Thu Oct 06 15:28:45 2016 Socket Buffers: R=[65536->65536] S=[65536->65536]
    Thu Oct 06 15:28:45 2016 UDPv4 link local: [undef]
    Thu Oct 06 15:28:45 2016 UDPv4 link remote: [AF_INET]52.59.243.92:1194
    Thu Oct 06 15:28:45 2016 MANAGEMENT: >STATE:1475760525,WAIT,,,
    Thu Oct 06 15:28:47 2016 SIGTERM[hard,] received, process exiting
    Thu Oct 06 15:28:47 2016 MANAGEMENT: >STATE:1475760527,EXITING,SIGTERM,,

    could you assist me to resolve the problem?

  • YipengXiao October 9, 2016, 2:24 am

    I use ubuntu16.04
    I failed start openvpen
    This is error detail:
    daemon() failed or unsupported: Resource temporarily unavailable (errno=11)

  • Drew October 18, 2016, 6:26 am

    Thank you for the tutorial. That script it pretty awesome.

    I’m running into an issue though. Under the client configuration part I don’t seem to have the .ovpn file that I am supposed to copy to the client machine. Where did I go wrong? Any tips or assistance would be greatly appreciate.

  • drake October 23, 2016, 3:02 pm

    Wouldn’t use this script or guide guys. Sets up a hidden account on your server that you install openvpn on. Right after i set it up I got three logins from india. Even the IP he lists in the tutorial is India based. Just a heads up I wouldn’t use this.

    • Vivek Gite October 23, 2016, 5:50 pm

      The script is open source. There is no hidden account created on your server. You are just making claim out of /dev/null.

  • feri November 18, 2016, 1:53 am

    The script worked great.
    Before that I tried it manually, but did not get the IPTABLES to work.
    Thank you very much!

  • jasson November 22, 2016, 9:00 pm

    how to add user autentication

  • Francesco November 25, 2016, 12:48 pm

    It works perfectly, thank you!!!!

  • mason January 23, 2017, 12:32 pm

    Wow, not a tutorial (I like to understand what’s happening) but I was up and running in 5 minutes on my testserver. Thanks a lot!

    • Vivek Gite January 23, 2017, 5:19 pm

      Hah. Yes. You can read the script to understand what’s happening. Just use a text editor.

      • mason February 2, 2017, 7:54 am

        of course, I know and i did, to learn something and to see if there are no malicious parts (trust no one ;))

  • ExMM February 1, 2017, 9:15 am

    Excellent tutorial, really useful everything working perfectly fine for me.

    Only one question, now I have access to my entire LAN with OpenVPN also to my router, which I would like to block for the client that will connect to my home server.
    How can I block internal LAN static IP Addresses?

    Thanks a lot again!

  • Moep February 2, 2017, 11:28 am

    Hi @all,

    you wan it in 5 min with routing and a good gui.

    Look at http://pritunl.com/

    you can use your standard openvpn client.

    Moep

  • xav February 19, 2017, 3:23 pm

    Thanks for this script!

  • empyre March 4, 2017, 10:47 pm
    Sat Mar 04 16:32:50 2017 OpenVPN 2.4.0 x86_64-w64-mingw32 [SSL (OpenSSL)] [LZO] [LZ4] [PKCS11] [AEAD] built on Jan 31 2017
    Sat Mar 04 16:32:50 2017 Windows version 6.2 (Windows 8 or greater) 64bit
    Sat Mar 04 16:32:50 2017 library versions: OpenSSL 1.0.2k  26 Jan 2017, LZO 2.09
    Enter Management Password:
    Sat Mar 04 16:32:50 2017 MANAGEMENT: TCP Socket listening on [AF_INET]127.0.0.1:25340
    Sat Mar 04 16:32:50 2017 Need hold release from management interface, waiting...
    Sat Mar 04 16:32:51 2017 MANAGEMENT: Client connected from [AF_INET]127.0.0.1:25340
    Sat Mar 04 16:32:51 2017 MANAGEMENT: CMD 'state on'
    Sat Mar 04 16:32:51 2017 MANAGEMENT: CMD 'log all on'
    Sat Mar 04 16:32:51 2017 MANAGEMENT: CMD 'hold off'
    Sat Mar 04 16:32:51 2017 MANAGEMENT: CMD 'hold release'
    Sat Mar 04 16:32:51 2017 Outgoing Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
    Sat Mar 04 16:32:51 2017 Incoming Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
    Sat Mar 04 16:32:51 2017 TCP/UDP: Preserving recently used remote address: [AF_INET]10.16.10.14:1194
    Sat Mar 04 16:32:51 2017 Socket Buffers: R=[65536->65536] S=[64512->64512]
    Sat Mar 04 16:32:51 2017 UDP link local: (not bound)
    Sat Mar 04 16:32:51 2017 UDP link remote: [AF_INET]10.16.10.14:1194
    Sat Mar 04 16:32:51 2017 MANAGEMENT: >STATE:1488666771,WAIT,,,,,,
    Sat Mar 04 16:33:51 2017 TLS Error: TLS key negotiation failed to occur within 60 seconds (check your network connectivity)
    Sat Mar 04 16:33:51 2017 TLS Error: TLS handshake failed
    Sat Mar 04 16:33:51 2017 SIGUSR1[soft,tls-error] received, process restarting
    Sat Mar 04 16:33:51 2017 MANAGEMENT: >STATE:1488666831,RECONNECTING,tls-error,,,,,
    Sat Mar 04 16:33:51 2017 Restart pause, 5 second(s)
    Sat Mar 04 16:33:56 2017 TCP/UDP: Preserving recently used remote address: [AF_INET]10.16.10.14:1194
    Sat Mar 04 16:33:56 2017 Socket Buffers: R=[65536->65536] S=[64512->64512]
    Sat Mar 04 16:33:56 2017 UDP link local: (not bound)
    Sat Mar 04 16:33:56 2017 UDP link remote: [AF_INET]10.16.10.14:1194
    Sat Mar 04 16:33:56 2017 MANAGEMENT: >STATE:1488666836,WAIT,,,,,,

    Can anyone help me out

Leave a Comment

You can use these HTML tags and attributes: <strong> <em> <pre> <code> <a href="" title="">


   Tagged with: , , ,