How to Auto Start OpenVPN Client on Ubuntu Bionic
Launch OpenVPN client as a daemon.
Here I assume you already have your own cert file -
Modify its file extension to
conf like so:
1mv filename.ovpn filename.conf
Put your cert file inside
/etc/openvpn directory like so:
1mv /path/to/filename.conf /etc/openvpn/
OpenVPN client service name would be
Well, you might already know what to do to launch the service.
1sudo killall openvpn 2sudo systemctl enable --now [email protected]
Reload the system daemons.
1sudo systemctl daemon-reload
That's it. 🙂
If you have
password for the certfile, you need this step
Make a credential file like so:
Put this into the file:
Open your certfile to edit:
1sudo vim /etc/openvpn/filename.conf
Edit or add in this line:
If you want to launch it manually each time, I recommend a shell script
Write a shell script like so:
1#!/bin/bash 2sudo killall openvpn 3sudo openvpn --daemon --config /path/to/filename.ovpn
You can now use the script file whenever you need it, even on startup.
Happy networking! 🙂