Debian/Ubuntu - Start OpenVPN Connection
I have quite a few posts on how to configure an OpenVPN server, but once you have one set up and have been provided all the certificate/configuration files, one needs to know how to launch a connection to the server with it. Here's how (on Ubuntu/Debian):
Steps
Install OpenVPN if you haven't already.
sudo apt-get install openvpn -y
Navigate to where your client configuration file is, and start the VPN connection by referencing it.
cd /path/to/client.conf/directory
sudo openvpn \
--config client.conf \
--up /etc/openvpn/update-resolv-conf \
--down /etc/openvpn/update-resolv-conf \
--script-security 2
/etc/openvpn/update-resolv-conf
ensure that your DNS updates when you connect/disconnect from the VPN connections,
so that you can make use of the connections internal DNS (if it exists). If you don't wish to take on the VPN's DNS suggestions, then remove those parts.
References
First published: 7th May 2022