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:
# openvpn nl-07.protonvpn.com.udp1194.ovpn
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.
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.
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.
# set "connection" mark of connection from eth0 when first packet of connection arrivessudo iptables -t mangle -A PREROUTING -i eth0 -m conntrack --ctstate NEW -j CONNMARK --set-mark 1234# set "firewall" mark for response packets in connection with our connection marksudo iptables -t mangle -A OUTPUT -m connmark --mark 1234 -j MARK --set-mark 4321# our routing table with eth0 as gateway interfacesudo ip route add default dev eth0 table 3412# route packets with our firewall mark using our routing tablesudo ip rule add fwmark 4321 table 3412