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 openvpn@filename
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:
1sudo touch /etc/openvpn/login.conf
Enter the following into the file.
Open your certfile to edit.
1sudo vim /etc/openvpn/filename.conf
Add this line or edit it if it already exists.
If you want to launch it manually each time, I recommend a shell script
Write a shell script with the following contents.
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! 🙂