OpenVPN on Ubuntu using Private Internet Access
I wanted to use a VPN on a Linux server (Ubuntu), using Private Internet Access, but without using the PIA client.
Steps
-
Install OpenVPN (I also install curl and net-tools, as I frequently use both):
sudo apt-get install openvpn curl net-tools -
Get necessary OpenVPN files from Private Internet Access, and copy local TEP (Tunnel End Point) config:
curl -O https://www.privateinternetaccess.com/openvpn/openvpn-nextgen.zip unzip openvpn-nextgen.zip sudo mv us_denver.ovpn /etc/openvpn/client/openvpn.conf -
Verify public IP before connecting:
curl ifconfig.me -
Connect to the VPN:
sudo openvpn —config openvpn.conf -
Open a new terminal window/tab, and verify that you get a different IP address than in step #3:
curl ifconfig.me -
Assuming everything works, terminal the VPN (control + c), then run the OpenVPN client as a service:
sudo systemctl start openvpn-client@openvpn.serviceNote: If you name your config file differently, change the command above to match your config file name. For example, if your config files is called myconfigfile.opvn, then you would run:
sudo systemctl start openvpn-client@myconfigfile.service -
Re-test the VPN connection, and if everything works, enable the OpenVPN client to start on boot:
sudo systemctl enable openvpn-client@openvpn.service