Set up OpenVPN in Windows

This guide shows you how to connect a Windows PC or Mac to an OpenVPN server running on a MikroTik Cloud Hosted Router. If you haven't set up your server yet, start with our OpenVPN server setup guide first.

Important: The date and time on both your router and your client device must fall within the validity period of the installed certificates. Enable NTP synchronisation on both the server and the client to avoid certificate verification failures.

Here's a short video overview of the process:

1
Download the OpenVPN client

There are two OpenVPN clients available for Windows and macOS. Pick whichever suits you — both work with a MikroTik CHR OpenVPN server.

While Connect is simpler, the Community client gives you more control. Download and install your preferred client before continuing.

2
Create a PPP user account on your CHR

Before you can connect, you need a VPN user account on the server. Log in to your MikroTik CHR via WinBox or Webfig, go to PPP > Secrets, and click + NEW. Set a username and a strong password and make sure the profile is set to default-encryption.

Creating a new PPP Secret in RouterOS — PPP > Secrets > New dialog with username BGOCloud-OVPN, password field and default-encryption profile selected

RouterOS CLIppp secret add name=MyWindowsUser password=StrongPassword profile=default-encryption comment="Windows client"

Keep this username and password handy — you'll enter them in the OpenVPN client when connecting.

3
Export the certificates from your CHR

You'll need the following files from your CHR to build or receive an OpenVPN configuration:

  • The CA certificate (.crt)
  • The client certificate (.crt)
  • The client certificate private key (.key)

In WinBox, go to System > Certificates. Right-click each certificate and choose Export. Give them clear names. When exporting the client certificate, always set a passphrase — you'll enter it in the OpenVPN client as the private key password.

Right-clicking the LMTCA certificate in MikroTik WinBox and selecting Export from the context menu

RouterOS CLIcertificate export-certificate LMTCA export-passphrase=""
certificate export-certificate CLIENT1 export-passphrase=12345678

The exported files appear in Files on the CHR. Select them all and drag-and-drop them to a folder on your computer, or right-click and choose Download.

MikroTik WinBox Files window showing exported certificate files — CA cert, server cert and client cert listed and ready to download

4
Create the .ovpn configuration file

There are two ways to get your .ovpn config: let RouterOS generate it for you (easiest, requires v7.9+), or build it manually from a template. Both methods produce a working config — the auto-export just saves a few steps.

4a. Auto-export from RouterOS (v7.9+) — easiest method

Since RouterOS v7.9, you can generate a complete .ovpn config directly from the CHR. It picks the best encryption settings automatically and embeds all the necessary certificates.

In WinBox, go to PPP > OVPN Servers and open any server(RouterOS 7.17+) or PPP > Interface > OVPN Server (older versions) and click Export .ovpn. Fill in your CHR's public IP address, then select the CA certificate, the client certificate, and its key.

RouterOS OVPN Server settings showing the Export .ovpn button and the Export .ovpn dialog with server public address, CA certificate LMTCA.crt, client certificate CLIENT1.crt and client key CLIENT1.key fields

The generated .ovpn file will appear in Files on the CHR. Right-click it and choose Download.

MikroTik WinBox Files window showing the exported .ovpn config file with the right-click Download option highlighted

One thing to be aware of: the RouterOS-generated config doesn't enable full tunnel routing or credential cache clearing by default. Open the file in any text editor and add these two lines just before the embedded certificate block:

.ovpn file — add before the <ca> block...
reneg-sec 3600
remote-cert-tls server
auth-nocache
redirect-gateway def1
<ca>
-----BEGIN CERTIFICATE-----
...

4b. Build the config from scratch

If you're on RouterOS older than v7.9, or want full control over the config, create a new file, give it a .ovpn extension, and open it in a text editor. Paste the template below, adjusting the IP address, port, protocol, cipher, and auth to match your server's settings. Then paste the contents of each certificate and key file into the matching section.

Example .ovpn configuration fileclient
dev tun
proto tcp-client
remote IP_ADDRESS_OF_YOUR_CHR
port 1194
nobind
persist-key
persist-tun
tls-client
remote-cert-tls server
<ca>
PASTE CONTENTS OF THE CA (LMTCA) CERTIFICATE HERE
</ca>
<cert>
PASTE CONTENTS OF THE CLIENT CERTIFICATE HERE
</cert>
<key>
PASTE CONTENTS OF THE ENCRYPTED PRIVATE KEY HERE
</key>
verb 4
mute 10
cipher AES-256-CBC
data-ciphers AES-256-CBC
auth SHA1
auth-user-pass
auth-nocache
redirect-gateway def1

If you prefer to keep the certificates as separate files rather than embedding them, replace the <ca>, <cert>, and <key> blocks with filename references instead. In that case, keep all files in the same folder as the .ovpn config.

Alternative — reference certificate files by filename...
tls-client
remote-cert-tls server
ca LMTCA.crt
cert CLIENT1.crt
key CLIENT1.key
verb 4
mute 10
cipher AES-256-CBC
...

4c. Pre-saving VPN credentials in the config (optional, but insecure — not recommended for shared devices)

The safest approach is to enter your VPN username and password in the OpenVPN client each time, or save them in the client app itself. However, if you need to pre-embed them in the config, there are two ways to do it. The username and password must always be on separate lines.

Option A — embed directly in the config:

Embedded credentials in .ovpn file...
cipher AES-256-CBC
data-ciphers AES-256-CBC
auth SHA1
<auth-user-pass>
Username
Password
</auth-user-pass>
auth-nocache
redirect-gateway def1
...

Option B — store credentials in a separate file and reference it. Create a plain text file named secret (no extension) with the username on the first line and password on the second:

Reference a credentials file in .ovpn...
auth SHA1
auth-user-pass secret
auth-nocache
...
Contents of the "secret" credentials fileUsername
Password
5
Connect using OpenVPN Connect client (Windows & macOS)
Note: If you update the configuration or replace certificates, you need to delete the existing profile and re-import it. OpenVPN Connect does not detect changes automatically.

Either double-click the .ovpn file or drag and drop it into the OpenVPN Connect window. A confirmation dialog will appear — click Import.

If you referenced certificate and credential(secret) files by filename rather than embedding them, make sure all files are in the same folder before importing.

Dragging the MikroTik.ovpn config file into OpenVPN Connect on Windows and the Confirm importing the profile dialog with the Import button

Click Connect. The client will prompt for your Private Key Password (the passphrase you set when exporting the client certificate), your VPN username, and password. Enter the credentials from Step 2.

If the server doesn't have client certificate verification enabled, any warning about a missing certificate can be safely dismissed.

OpenVPN Connect on Windows showing the Connect button and the Enter credentials dialog with Username, Password and Private Key Password fields

Once connected, you're in. To save your credentials so you don't have to re-enter them every time, open the burger menu (☰), go to My Profiles, and click the pencil icon next to your profile. Enter your credentials and click Save Changes.

OpenVPN Connect showing the burger menu > My Profiles > edit pencil icon > credentials form with Username, Password and Private Key Password fields and Save Changes button

On Windows, the connection can be controlled from the OpenVPN Connect icon in your system tray. Right-click it to quickly connect, disconnect, or switch profiles without opening the full app.

Windows system tray right-click context menu for OpenVPN Connect showing Connect, Settings, Import Profile, Add Proxy and Exit options

6
Connect using OpenVPN Community client (Windows only)
Note: When you update the config or certificates, replace the files in the OpenVPN config folder. By default, the Community client stores profiles in %USERPROFILE%\OpenVPN\config\.

Find the OpenVPN GUI icon in your Windows system tray (it looks like a small monitor with a padlock). Right-click it, hover over Import, then choose Import file… and locate your .ovpn file.

Again, if you referenced certificate files and credentials(secret) by filename, keep them all in the same folder as the config.

OpenVPN Community client on Windows — right-clicking the system tray icon, selecting Import > Import file, and the Windows file dialog showing MikroTik.ovpn selected

Right-click the tray icon again and choose Connect (or go to your profile name and click Connect there if you have multiple profiles). The client will ask for your VPN username and password, and then for the private key password. Check Save password if you don't want to type them each time.

OpenVPN Community client connection log window with the username and password dialog overlaid, showing Save password checkbox, and a separate Private Key Password prompt


Your Windows PC or Mac is now connected to your MikroTik CHR OpenVPN network. If you run into problems getting connected, check our OpenVPN troubleshooting guide for common issues and fixes.

Need a MikroTik CHR to host your VPN on? BGOCloud's MikroTik VPS plans give you full RouterOS access, SSD performance, and unlimited traffic options — ready in under a minute. The perfect foundation for running a private OpenVPN server.

Get hosting solutions with easy-to-use control panel. Choose from variety of services at low prices.

Get Started!
icon knowledge

Related Articles

MikroTik CHR: Setup Secure VPN access between client and server using OpenVPN

In this article, we will show you how to set up secure VPN access to your server using OpenVPN....

Set up OpenVPN Client in MacOS

In this article, we will show you how to connect your MacBooks and Macs to your OpenVPN Server....

Setup OpenVPN Connect Client in Android

This guide walks you through connecting your Android phone or tablet to an OpenVPN server running...

How To: Connecting Android phones to OpenVPN Access Server

No matter what operating system or device you work with, we have an OpenVPN Server solution for...