The instructions below assume a Debian based distro. Please substitute as neccessary.
- Install OpenVPN using your package manager.
sudo apt-get install openvpn
- Download the OpenVPN config files to your home directory and extract the contents.
- 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
- 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/
- 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 lineauth-user-pass
toauth-user-pass pass
- 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 theresolvconf
oropenresolv
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
- 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
- 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 ofip addr
. - Check your external IP to verify that you are connected.
curl ifconfig.co
Troubleshooting
- 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
- To view the logs use grep to filter them from the log.
sudo grep VPN /var/log/syslog
Was this answer helpful?