IPVanish is a great VPN service growing in popularity. IPVanish provides plenty of bandwidth to allow fast downloads while being secured with encryption for maximum privacy and anonymity. IPVanish don't keep any logs so they take your privacy seriously. This guide shows you how to configure OpenVPN with IPVanish on Debian or Ubuntu and will work on the Raspberry Pi and Banana Pi too. It also shows you how to autostart your VPN connection on boot.
Configure IPVanish OpenVPN on Debian + Ubuntu
Get your IP on the internet first to compare after you have run it again
SSH in to your device and check your public IP address
wget http://ipecho.net/plain -O - -q ; echo
Install OpenVPN
sudo apt-get install openvpn -y
Reboot to make sure your tunnel adapter gets installed
sudo reboot
SSH in again and enter the OpenVPN folder to store your IPVanish configs and login details (insecure but convenient)
cd /etc/openvpn
Download the IPVanish VPN certificate file
sudo wget http://www.ipvanish.com/software/configs/ca.ipvanish.com.crt
Choose IPVanish ovpn files to use from here depending on which country you want to connect through.
Right click and copy the link to use below for copying the configuration file
sudo wget https://www.ipvanish.com/software/configs/ipvanish-ES-Madrid-mad-a01.ovpn
Create a file for your login credentials, this is not particularly secure but it is convenient
sudo nano /etc/openvpn/login.txt
Paste your IPVanish username and format like this, if you got VPN from UsenetServer add @usenetserver to username
username
password
Ctrl+X, Y and Enter to save
Add Google's DNS servers or you won't be able to use DNS on your device
echo "nameserver 8.8.8.8" | sudo tee -a /etc/resolv.conf
echo "nameserver 8.8.4.4" | sudo tee -a /etc/resolv.conf
Make the resolv.conf file immutable (i.e. unchangeable) (source)
sudo chattr +i /etc/resolv.conf
Try establishing an OpenVPN connection to IPVanish specifying the ovpn file you wish to use and the login file you created
sudo openvpn --config /etc/openvpn/ipvanish-ES-Madrid-mad-a01.ovpn --auth-user-pass /etc/openvpn/login.txt
You should see something along these lines if the OpenVPN IPVanish connection was successful
Wed Oct 21 16:41:44 2015 /sbin/ip route add 81.171.69.2/32 via 192.168.40.1
Wed Oct 21 16:41:44 2015 /sbin/ip route add 0.0.0.0/1 via 172.20.32.1
Wed Oct 21 16:41:44 2015 /sbin/ip route add 128.0.0.0/1 via 172.20.32.1
Wed Oct 21 16:41:44 2015 Initialization Sequence Completed
You will need to start a new SSH session to check the IPVanish IP address
wget http://ipecho.net/plain -O - -q ; echo
You should see output like this
81.171.69.45
Autoconnect IPVanish OpenVPN on Start
You are going to add the command to /etc/rc.local so you autoconnect to IPVanish VPN servers
sudo nano /etc/rc.local
At the bottom add this code before exit 0, there should only be one exit 0
sleep 5
cd /etc/openvpn
sudo openvpn --config /etc/openvpn/ipvanish-ES-Madrid-mad-a01.ovpn --auth-user-pass /etc/openvpn/login.txt
exit 0
Ctrl+X, Y and Enter to save