OpenVPN configuration


 1. Update information about packages:

sudo apt-get update

 2. Install OpenVPN client:

sudo apt-get install openvpn

 3. Download and unpack configuration files from your customer area: https://vpntunnel.com/en/account/server-info

sudo unzip /etc/openvpn/configs.zip -d  /etc/openvpn
sudo rm -rf /etc/openvpn/configs.zip
sudo rename "s/.ovpn/.conf/" /etc/openvpn/*.ovpn

 4. Show all available locations:

ls /etc/openvpn/*.conf

 5. Set up connection:

sudo openvpn --config /etc/openvpn/Milan.conf

 

Optionally: autostart connection at boot time


1. Create file with your credentials:  

echo 'username' | sudo tee /etc/openvpn/creds.txt
echo 'password' | sudo tee --append /etc/openvpn/creds.txt

 2. Change configuration files:

sudo sed -i 's/auth-user-pass/auth-user-pass \/etc\/openvpn\/creds.txt/g' /etc/openvpn/*.conf

 3. Edit /etc/default/openvpn. Replace "Milan" With location that you need.

echo "AUTOSTART=\"Milan\"" | sudo tee --append /etc/default/openvpn

 

 Please note that above step could not work for you, here is another solution:


 3. Edit  /etc/rc.local file

sudo nano /etc/rc.local


Add " sudo openvpn --config /etc/openvpn/Country\ -\ city.conf & "at the end of the file, make sure you type it before  "exit 0"  and before any other line that would start another program at boot. Don't forget the ampersand (&).  

Here is an example of already modified rc.local file

______________
#
# By default this script does nothing.

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"
fi

# Start openvpn on boot:

sudo openvpn --config /etc/openvpn/Switzerland\ -\ Zurich.conf &

#Start Deluge on boot

sudo -u pi /usr/bin/python /usr/bin/deluged

sudo -u pi /usr/bin/python /usr/bin/deluge-web

exit 0