Tutorial: Use OpenVPN Service Binary on Windows to Automatically Connect to CloudConnexa on Startup
This tutorial shows you how to use the OpenVPN Service binary to run as a system service. This means that if the service is properly installed and configured, it will establish an OpenVPN connection automatically on system start-up, regardless of whether it was explicitly started or not.
Introduction
Starting from the OpenVPN Connect app version 3.2, the application includes the OpenVPN Service binary that allows running an OpenVPN connection as a system service. This means that if the service is properly installed and configured it will establish an OpenVPN connection automatically on system start-up, regardless of whether it was explicitly started or not.
Follow these steps in order to do that on Windows:
Connect App Installation
Go to https://openvpn.net/client-connect-vpn-for-windows/ and click Download OpenVPN Connect V3.
Note
If you are using CloudConnexa or Access Server, you may also download OpenVPN Connect with an already existing OpenVPN Profile from the portal.
After the download has been completed, click on the set up in the Downloads pop-up bar in your browser.
In the OpenVPN Connect setup Wizard that has just opened, click Next.
Read the License Agreement and click on the I accept the terms in the License Agreement checkmark (in case you accept the terms).
Click Next.
In the Driver Selection window, choose a driver and click Next.
Click the Install button in order to begin the installation process.
Finally, click Finish in order to finish the setup process after the installation has been completed.
Starting System Service
Press Win+S on your keyboard in order to open the Search window, then type
cmd
in order to find the Command Prompt.Now, click Run as Administrator in the panel on the right.
Type
cd/
in the Command Prompt Window in order to go to the top of the directory tree.Next, type
cd %ProgramFiles%/OpenVPN Connect
(if you are using the x64 version) orcd %ProgramFiles(x86)%>/OpenVPN Connect
(if you are using the x86 version) in the Command Prompt Window in order to navigate to the default directory where OpenVPN Connect is located.Install the system service by typing the following command into the Command Prompt:
ovpnconnector.exe install
.Note
The system service will not be automatically installed when you install the OpenVPN Connect app. You will still have to install the service in the Command Prompt after you have installed the app.
Optional Now, configure the OpenVPN Profile that will be running automatically with system service by typing the following command into the Command Prompt:
ovpnconnector.exe set-config Profile <path-to-Profile.ovpn>
Important
Only autologin profiles are supported at the current moment. Even if the downloaded Profile has been moved to
%ProgramFiles%/OpenVPN Connect
, you still have to enter the full path to the OpenVPN Profile.Note
If this step was skipped, the service will try to connect via Profile located at the service directory
namedovpnconnector.ovpn
. If Connect client was downloaded from Access Server or CloudConnexa and has a bundled Profile,ovpnconnector.ovpn
is a copy of a bundled Profile.Optional Specify the path to a log file by typing the following command into the Command Prompt:
ovpnconnector.exe set-config log <path-to-log>
.Important
The log file will only appear in the intended directory only after the connection has been established. If there is no log file in the directory, then the connection has not been established.
Note
If not specified, the service will write logs to the file located at the same directory named
ovpnconnector.log
. Apart from writing regular OpenVPN logs to the configured log file service will also report any critical errors to the system Event Viewer → Windows Logs → Applications. (Event source:OVPNConnectorService
).Start the service by typing the following command into the Command Prompt:
ovpnconnector.exe start
. This command will try to establish a connection via a configured Profile using system service.Important
OpenVPN Connect client should not be running, otherwise, service startup will abort.
Open the log file you specified in Step 7 or the default
%ProgramFiles%/OpenVPN Connect/ovpnconnector.log
in order to verify that the OpenVPN connection was successfully established. Scroll to the very end, and find the line<timestamp> EVENT: CONNECTED <OpenVPN Profile name>
, which will confirm the connection's success.Important
The log file will only appear in the intended directory if the connection was successful. If there is no log file, then the connection has not been established
Notice that you can’t use OpenVPN Connect when the service is running, the application UI will be blocked by the corresponding modal window. It will disappear if you stop the service.
Notice how now, if you restart your machine, the OpenVPN connection will be established automatically on system start-up thanks to this system service, regardless of whether it was explicitly started or not.
Using System Service
You can check service status in Windows Services utility by pressing Win+S and typing Services into the Windows search bar and clicking Services in the search results.
Here, find the OpenVPN Connect 3.x Connector service in the Windows Services tab. Notice how now, if you restart your machine, the OpenVPN connection will be established automatically on system start-up thanks to this system service, regardless of whether it was explicitly stated or not.
Notice that you can stop or restart the service from this tab. If you click Stop, the OpenVPN connection will be terminated.
Important
Connection will restart automatically after the system reboot unless you remove the service.
You will also be able to start the service in case it was stopped from the Windows Services tab.
Stop and Remove System Service
You can stop the service by entering the following command into the Command Prompt:
ovpnconnector.exe stop
. A OpenVPN connection will be terminated.Important
Connection will restart automatically after the system reboot unless you remove the service.
Configured paths to the connection Profile and the log file can be rolled back to default values using the following commands in the Command Prompt:
ovpnconnector .exe unset-config Profile
andovpnconnector.exe unset-config log
.Important
The service needs to be stopped first to change the configuration. You will be able to use a different CloudConnexa session as a system service only after running
ovpnconnector.exe unset-config
Profile, as a System Service will still be present, but it won’t have the Running status in Windows Services since it will have no OpenVPN Profile associated with it. Afterward, to change the OpenVPN Profile of the system service, simply go through the steps in the section Starting System Service with a new OpenVPN Profile.If you want to remove system service run the command:
ovpnconnector.exe remove
Default Connect App settings for connection
Connection Timeout: Continuously retry (try to connect indefinitely)
Seamless Tunnel: Enabled (Block traffic while OpenVPN connection is paused or reconnecting)
The rest of the settings can be configured in the Profile itself