Use OpenVPN Connect v3 on Windows in service daemon mode (2024)

Abstract

Set up an OpenVPN connection as a system service on Windows with service daemon mode for OpenVPN Connect.

On Windows, OpenVPN Connect 3.2 and newer includes a method to set up an OpenVPN connection as a system service. You can configure the connection to run right after system boot, even when nobody is logged on. A few possible use cases:

  1. A Windows Server with Remote Desktop Services, where the users need access to some VPN resources, and it's not practical or possible to have each user establish connections because of technical and organizational reasons.

  2. A Windows client system that is joined to a domain that needs access to a VPN network domain that is required for logon purposes, so the connection needs to be up and running before the user logs in.

  3. Connecting your Windows system as an unattended host system offering certain services and resources to your OpenVPN server or to CloudConnexa.

We designed this system service mode for system administrators. Once the connection is up, administrators and unprivileged users on the system can reach resources available through this VPN connection.

Before you begin

Ensure you have the following set up:

  1. OpenVPN Connect v3 of version v3.2 or higher.

  2. Administrator shell (PowerShell or cmd).

  3. An autologin-type connection profile (the service daemon has no interactive capabilities).

  4. Close the OpenVPN Connect v3 window before setting up the system service.

  5. Run all commands from the program location (as specified below).

  • x64: %ProgramFiles%\OpenVPN Connect\ovpnconnector.exe

  • x86: %ProgramFiles(x86)%>\OpenVPN Connect\ovpnconnector.exe

Set up OpenVPN Connect in service daemon mode

Following these steps to set up OpenVPN Connect to run in service daemon mode:

  1. Go to the correct location for your system (for our example, we use an x64 system):

    cd "%ProgramFiles%\OpenVPN Connect\"

    Tip

    Ensure you use the correct location for your system.

  2. Install the system service:

    ovpnconnector.exe install
  3. Specify the connection profile to use (optional):

    ovpnconnector.exe set-config profile <FULL_PATH_AND_FILENAME_TO_PROFILE.OVPN>

    Note

    If you downloaded your OpenVPN Connect installation file from Access Server or CloudConnexa and it came with a bundled autologin connection profile, you can skip step three. It will then simply default to the bundled connection profile. You can find it in the program location with the name "ovpnconnector.ovpn" — that's the bundled connection profile.

  4. Specify the path to a log file (optional):

    ovpnconnector.exe set-config log <FULL_PATH_AND_FILENAME_TO_LOGFILE.LOG>

    Note

    If you skip step four, the service writes to the default log file in the program location with the name, "ovpnconnector.log".

  5. Start the service:

    ovpnconnector.exe start
    • The service starts the VPN connection and logs output to the log file.

      See Also
      Android

    Tip

    You don't receive any feedback about whether the connection succeeds or not after you start the service. You can check the log file or use the ping command to verify that the connection is up and running.

    Important

    OpenVPN Connect should not be running, otherwise service startup aborts.

Usage details

If you've installed and configured the service correctly, it automatically establishes a VPN connection on system startup. In other words, the system service starts at every boot.

Apart from writing regular OpenVPN logs to the configured log file, the service also reports any critical errors to the system: Event Viewer → Windows Logs → Applications. (Event source: OVPNConnectorService).

You can check the service status in the Windows Services (services.msc) utility. You can stop, start, and restart the service there.

On the command line, this is also possible with ovpnconnector.exe:

ovpnconnector.exe stop/start/restart

Or using the Windows 'net' command-line tool:

net stop/start/restart ovpnconnector

Important

You can't use the OpenVPN Connect v3 graphical interface while the service is running.

An administrator must manage the service using the tools mentioned above. The service blocks the graphical interface from running to prevent users from interfering with the VPN connection.

When an admin stops the service, the OpenVPN Connect v3 graphical interface will become available again.

Default OpenVPN settings for connection

The service runs with the following OpenVPN settings:

  • Connection Timeout: "Continuously retry" (try to connect indefinitely).

  • Seamless Tunnel: Enabled (block VPN while VPN is paused or reconnecting).

You can configure other possible settings in the connection profile with standard OpenVPN directives.

Revert configuration to default

If you need to undo a configuration setting for the OpenVPN connection profile path or the log file path to revert them to defaults, you can use these commands:

ovpnconnector.exe unset-config profileovpnconnector.exe unset-config log
Stop or remove the service

Use the following commands to stop or remove the service.

Stop the service

ovpnconnector.exe stop

The service stops, and the active OpenVPN connection terminates. On the next reboot, the service starts and reconnects.

Remove the service

ovpnconnector.exe remove

The system stops and the active OpenVPN connection terminates. You've removed the service from the system.

In this section:

Use OpenVPN Connect v3 on Windows in service daemon mode (2024)

FAQs

How to run OpenVPN as a service in Windows? ›

Once running in a command prompt window, OpenVPN can be stopped by the F4 key. Run OpenVPN as a service by putting one or more .ovpn configuration files in \Program Files\OpenVPN\config and starting the OpenVPN Service, which can be controlled from Start Menu -> Control Panel -> Administrative Tools -> Services.

How do I start OpenVPN connect as a service? ›

Set up OpenVPN Connect in service daemon mode
  1. Go to the correct location for your system (for our example, we use an x64 system): cd "%ProgramFiles%\OpenVPN Connect\" ...
  2. Install the system service: ...
  3. Specify the connection profile to use (optional): ...
  4. Specify the path to a log file (optional): ...
  5. Start the service:

Why is OpenVPN Connect not working? ›

This indicates that the address and port that OpenVPN Connect is trying to reach doesn't have an Access Server web service running there. This can sometimes occur if your server address is misconfigured. To resolve this, ensure you've configured your server address correctly: Sign in to the Admin Web UI.

What is the TCP port number for the OpenVPN daemon? ›

The OpenVPN daemons and web services

By default, Access Server comes configured with OpenVPN daemons listening on UDP port 1194 and TCP port 443. Access Server's web services also use TCP 443 for the web interfaces.

How to run OpenVPN from cmd? ›

To run OpenVPN, you can:
  1. Right click on an OpenVPN configuration file (. ovpn) and select Start OpenVPN on this configuration file. ...
  2. Run OpenVPN from a command prompt Window with a command such as "openvpn myconfig. ovpn". ...
  3. Run OpenVPN as a service by putting one or more .

How do I use OpenVPN on Windows? ›

How do I install the Windows client?
  1. Download the MSI file.
  2. Open and start the setup wizard.
  3. Give permissions to install on your Windows OS.
  4. Complete the OpenVPN Connect Setup Wizard.
  5. The OpenVPN logo displays in your tray (bottom right) with DISCONNECTED status.
  6. Click on the icon to start the Onboarding Tour.

What is OpenVPN V3? ›

The OpenVPN 3 Linux project is a new client built on top of the OpenVPN 3 Core Library, which is also used in the various OpenVPN Connect clients.

How do I start OpenVPN client automatically in Windows? ›

Here are the steps to do that, outlined in the section below:
  1. The user installs OpenVPN Connect.
  2. The admin allows an auto-login connection profile for the user.
  3. The user downloads an auto-login profile.
  4. The user sets the OpenVPN Connect launch options.
  5. OpenVPN Connect connects to the VPN automatically at startup.

What is the difference between OpenVPN GUI and OpenVPN connect? ›

The OpenVPN GUI, aka. OpenVPN Community Client, is an open source OpenVPN client for Windows. The OpenVPN Connect client, aka. OpenVPN Desktop Client or OpenVPN-AS Client, is a proprietary client distributed with OpenVPN Access Server.

Why am I unable to connect to a VPN service? ›

Restart your VPN software

If your VPN has its own program, quit the program and restart it to see if that resolves the issue. If the VPN is a browser plug-in, close your browser down and restart it. If restarting doesn't address the problem, try reinstalling the VPN as an additional measure.

How do I know if OpenVPN is working? ›

Check OpenVPN Status

The first place to check is Status > OpenVPN, which displays the connection status for each OpenVPN instance. If a VPN is connected, waiting, reconnecting, etc, it is indicated on that screen. For more information, see OpenVPN Server and Client Status.

How do I activate OpenVPN? ›

Activate a subscription license
  1. Sign in (or create an account) on openvpn.net for Access Server.
  2. Click Purchase a Subscription or Activation Keys.
  3. Select your number of connections and billing cycle.
  4. Click Purchase.
  5. Review your order and checkout. ...
  6. Copy the activation key.
  7. Click Configuration > Activation.

Should I use OpenVPN TCP or UDP? ›

TCP, UDP, and OpenVPN

OpenVPN's default is to use UDP simply because it is faster. Our smart protocol selection feature will always attempt to establish a connection using UDP first. But you can also switch between UDP and TCP manually in our app or command line tool.

What port is OpenVPN admin web? ›

OpenVPN Access Server hosts both the Admin Web and Client Web UIs on TCP ports 443 and 943.

What is the default port number for VPN? ›

Default VPN ports depend on a VPN protocol. However, a user can customize them. The most common VPN ports include 1194 for OpenVPN UDP and TCP port 443, 500 for IPsec/IKEv2, and 1723 for PPTP.

How do I host an OpenVPN server on Windows? ›

The purpose of this article is to provide the know-how needed to configure a working OpenVPN server on a Windows PC.
  1. Step 1: installing OpenVPN software. ...
  2. Step 2: preparing EasyRSA. ...
  3. Step 3: generating certificates and keys. ...
  4. Step 4: OpenVPN server configuration. ...
  5. Step 5: configuring clients. ...
  6. Step 6: launching the server.

How do I run OpenVPN as administrator in Windows 10? ›

OpenVPN – Run as Administrator – Windows
  1. Easiest. ...
  2. Right click on the OpenVPN connect Icon, click properties.
  3. Click the Compatibility tab, in the Privilege Level box, tick Run this program as an administrator, click OK.

How do I use Windows VPN service? ›

Connect to a VPN
  1. On the far right of the taskbar, select the Network icon (either or ).
  2. Select the VPN connection you want to use, then do either of the following depending on what happens when you select the VPN connection: ...
  3. If you're prompted, enter your username and password or other sign-in info.

Top Articles
Latest Posts
Article information

Author: Allyn Kozey

Last Updated:

Views: 5989

Rating: 4.2 / 5 (43 voted)

Reviews: 90% of readers found this page helpful

Author information

Name: Allyn Kozey

Birthday: 1993-12-21

Address: Suite 454 40343 Larson Union, Port Melia, TX 16164

Phone: +2456904400762

Job: Investor Administrator

Hobby: Sketching, Puzzles, Pet, Mountaineering, Skydiving, Dowsing, Sports

Introduction: My name is Allyn Kozey, I am a outstanding, colorful, adventurous, encouraging, zealous, tender, helpful person who loves writing and wants to share my knowledge and understanding with you.