In this tutorial, you will learn how to implement an OpenVPN client connection on a Raspberry pi. The OpenVPN service uses certificates to authenticate connections between the Server and the client. So before you begin, you must make sure that you have an OpenVPN Server running and have generated the required certificates.
OpenVPN is a virtual private network system that makes it possible to set up a secure point-to-point or site-to-site connections in routed or bridged configurations also sometimes known as tunnels
With your certificates ready, you must first install OpenVPN on your raspberry
sudo apt-get update
sudo apt-get install openvpn
After the installation copy your certificate files and store them in the created openvpn folder
sudo cp ca.crt mycrt.crt mykey.key openvpn.conf /etc/openvpn
Replace the mycrt.crt and mykey.key with your certificate name and key name
Navigate into the openvpn folder
/etc/openvpn/
Open the OpenVPN config file. (I am using the geany editor)
geany openvpn.conf
Uncomment or add the following three lines
persist-key
persist-tun
persist-remote-ip
Modify the paths for your client certificates
ca /etc/openvpn/ca.crt
cert /etc/openvpn/mycrt.crt
key /etc/openvpn/mykey.key
Save and close the config file
To start OpenVPN, run the following command
sudo openvpn openvpn.conf
You should now be ready, up and running . Good luck!