Install the necessary packages#
Install openvpn
if needed:
To prevent DNS leakage you'll need an additional package, for more info see Arch Linux Wiki.
Using systemd < 229#
Install openvpn-update-resolv-conf
or openvpn-update-resolv-conf-git
:
but you will may need to change all ProtonVPN config files from:
to:
or alternatively if you don't want to edit your client configuration, you can add the following options to your openvpn command:
Using systemd >= 229#
Install openvpn-update-systemd-resolved
:
but you will need to change all ProtonVPN config files from:
to:
or alternatively if you don't want to edit your client configuration, you can add the following options to your openvpn command:
Get the ProtonVPN config files#
Create an account or log in account.protonvpn.com.
Go to the download menu an download the config file you need (choose country and protocol).
Note: if using a free account only Connect to server
and a restricted number of country and server are available:
Find your OpenVPN credentials in the account menu. You man need to init the OpenVPN password.
Connecting using the command line interface (CLI)#
Launch openvpn
with privileges:
Note: don't forget to use the additionnal arguments that we saw during the install if you didn't change the config files. For example I'm using openvpn --setenv PATH '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' --up /etc/openvpn/update-resolv-conf --/etc/openvpn/update-resolv-conf --down-pre --config nl-07.protonvpn.com.udp1194.ovpn
, please not that when using arguments you need to use --config
else you'll have an error message like Options error: Unrecognized option or missing or extra parameter(s) in [CMD-LINE]:1: /etc/openvpn/update-resolv-conf (2.4.2)
.
When seeing Initialization Sequence Completed
you are succesfully connected.
Be carefull with remote connections#
Launching OpenVPN remotly (ex: via SSH) on a server like a VPS or a dedicated server can be dangerous. Using a VPN will change you IP address and default gateway so your remote connection will drop and you won't be able to connect to your server anymore. To recover you'll need an alternative net rescue mode or a hard reboot.
In order not to break your active remote connection you will need to set up appropriate route before lauching openvpn.
See this answer on serverfault.com:
It uses iptables and ip (iproute2). Below, it is assumed that the default gateway interface before OpenVPN is started is "eth0". The idea is to ensure that when a connection to eth0 is made, even if eth0 is not the default gateway interface anymore, response packets for the connection go back on eth0 again.
You could use the same number for the connection mark, firewall mark and routing table. I used distinct numbers to make the diffences between them more apparent.