I am, as a developer often have to connect via VPN to the database. Very ofter I am also using openvpn
The command to run the vpn connection looks like below
sudo openvpn --config myConfig.ovpn
The file myConfig.ovpn looks like this
client
remote someremoteaddress.com
route-delay 2
ca [inline]
cert [inline]
key [inline]
<ca>
-----BEGIN CERTIFICATE-----
-----END CERTIFICATE-----
</ca>
<cert>
-----BEGIN CERTIFICATE-----
-----END CERTIFICATE-----
</cert>
<key>
-----BEGIN PRIVATE KEY-----
-----END PRIVATE KEY-----
</key>
When the connection is succed we can work with vpn.
Sometimes the session with opened vpn connection didn't close correctly, and then connection to the vpn server can't be done in the correct way. At that moment we can see the success in our command line interface but vpn doesn't work.
How to resolve the issue.
First, I can check the active connections from my machine
ps aux | grep openvpn
## output
....another connections
username 91566 0,0 0,0 450724640 1632 s000 S+ 12:44 0:00.01 grep openvpn
If we will see some another connections which we don't want, we can just remove them using the key
sudo kill 91566
After that just reconnect to the remove VPN and everything should work.
Happy codding 🥳