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