The instructions below assume a Debian based distro. Please substitute as neccessary.

  1. Install OpenVPN using your package manager.
    sudo apt-get install openvpn
  2. Download the OpenVPN config files to your home directory and extract the contents.
  3. You can initiate an OpenVPN connection by simply specifying the configuration file you wish to use. You will need to manually enter your VPN username and password.
    /sbin/openvpn --config Germany.ovpn
  4. The remainder of this guide assumes you want to run OpenVPN as a service/daemon. Copy the .ovpn file to /etc/openvpn/.
    sudo cp ~/ivpn-openvpn-config/Germany.ovpn /etc/openvpn/
  5. If you wish to save your username/password, create a text file /etc/openvpn/pass and enter your username on the first line (starts with 'ivpn') and your password on the 2nd line. Then edit the .ovpn file you copied in the previous step and change the line auth-user-pass to
    auth-user-pass pass
  6. If you wish to use the IVPN DNS servers then you need to configure a resolve script which will automatically configure the /etc/resolv.conf file with the IVPN DNS servers when connecting and remove them on disconnection. Install the script by installing the resolvconf or openresolv package depending on the distro you are using. Most distributions will install the script in /etc/openvpn/update-resolv-conf. If you cannot install the package then you can use a generic script such as the one on the arch wiki. Once this script is in place edit the .ovpn file from step 2 and add the lines below:
    script-security 2
    up /etc/openvpn/update-resolv-conf
    down /etc/openvpn/update-resolv-conf
    
  7. Start the OpenVPN service. If you did not follow step 5 then you will be prompted to enter your username and password.
    sudo service openvpn start
  8. To check that the OpenVPN tunnel has started you can see if a tun device has been created (normally tun0) by looking at the output of ip addr.
  9. Check your external IP to verify that you are connected.
    curl ifconfig.co

Troubleshooting

  1. Most issues can be easily resolved by reviewing the logs. Some distributions will write OpenVPN logs to the syslog e.g. /var/log/syslog or /var/log/messages. If you cannot see OpenVPN log entries in syslog, add a new directive to the .ovpn file to enable file logging.
    log /var/log/openvpn
  2. To view the logs use grep to filter them from the log.
    sudo grep VPN /var/log/syslog
Was this answer helpful?

Can you please tell us how we can improve this article?