Setup an always on VPN in Ubuntu

Always on VPN

This is a guide on how to set up an always on VPN in Ubuntu, and basic troubleshooting of VPNs in ubuntu server. I used Private Internet Access as an example VPN connection.
Use my affiliate link to get a Private Internet Access VPN: http://www.privateinternetaccess.com/pages/buy-vpn/christitus. This is a must-have for a dedicated Linux box specifically for privacy concerns.

Setup VPN in Ubuntu – No Commentary

Setup VPN in Ubuntu – With Commentary

VPN setup commands:

sudo su
apt-get install openvpn -y
cd /etc/openvpn
wget https://www.privateinternetaccess.com...
unzip openvpn.zip
rm openvpn.zip
nano .secrets
###PASTE YOUR INFO### p1234567
###PASTE YOUR INFO### MyPIAPassword
chmod 600 .secrets
mv 'US Texas.ovpn' texas.conf
nano texas.conf
###CHANGE THIS LINE### auth-user-pass .secrets
systemctl start openvpn@texas
systemctl status openvpn@texas
nano /etc/default/openvpn ###UNCOMMENT AUTOSTART
reboot

Diagnostic Commands

Once complete, find the external IP as that is needed to make sure it is working. If your VPN is failing to connect I recommend using tail on the syslog so consequently, you can find any issues that are stopping the connection.

###Extra Tools###
Find External IP: dig TXT +short o-o.myaddr.l.google.com @ns1.google.com | awk -F'"' '{ print $2}'
Debug as necessary: tail -f /var/log/syslog|grep ovpn

In closing, make sure you always use a VPN when you are concerned about your privacy. I’ve also set these up on Linux boxes between offices and it makes for a great inexpensive site-to-site VPN. Therefore, you don’t have to spend tons of money on proprietary gateways that go out of date in a couple years.

Leave any Questions and Comments below and I will get back to you. I regularly publish on YouTube, Steemit, and christitus.com so if you’d like to see more videos please like, subscribe, and follow me.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: