This guide configures an IPv4 OpenVPN server on MikroTik RouterOS 7.20+ using UDP, AES-256-GCM, a client certificate and a username/password. The profile can be imported into OpenVPN Connect on Windows, Android and iOS.
Architecture
Remote clients connect to the MikroTik public endpoint. The router assigns a VPN address and pushes routes to two internal networks. The initial configuration uses split tunneling: internal traffic crosses the VPN, while ordinary internet traffic uses the client's local connection.
- Public endpoint: vpn.example.net, represented here by 203.0.113.10.
- OpenVPN listener: UDP port 1194, IP/TUN mode.
- VPN subnet: 10.250.60.0/24; router tunnel address 10.250.60.1.
- Client pool: 10.250.60.10–10.250.60.49.
- Internal networks: 192.168.40.0/24 and 192.168.50.0/24.
- Certificates: CA valid for 3650 days; server and client certificates valid for 1827 days, at least five years.
All addresses, names and accounts below are examples. Replace 203.0.113.10 with your public IP; it is a documentation address. The VPN subnet must not overlap the internal networks or the remote client's local network.
The router already has a working WAN/default route, routes to both internal networks and an existing stateful firewall that accepts established/related connections. Its WAN interface list must contain the actual internet interface. If the router sits behind another gateway, forward UDP 1194 there to the MikroTik WAN address as well.
Commands that add objects are intended for a new configuration. Output blocks are illustrative and shortened; most successful add/set commands return no text.
Allow UDP 1194 in the Firewall
Allow incoming VPN connections in the input chain. This rule is inserted before existing drop rules and does not replace the rest of the firewall.
Example output, shortened:
Synchronize the Router Clock
Certificate issuance and validation depend on accurate time. Enable the MikroTik NTP client and confirm synchronization before generating certificates. UTC is used here to keep the displayed timestamps consistent.
Example output, shortened:
Create the CA and Server Certificate
Create a dedicated CA, sign it and mark it trusted. Keep its private key on the router.
Create the server certificate with TLS server usage. The client profile will verify its Common Name, vpn.example.net, even when connecting to the public IP.
Example output, shortened:
Create the Address Pool and PPP Profile
The PPP profile assigns VPN addresses. Its interface list groups dynamically created VPN interfaces for firewall rules.
Example output, shortened:
only-one=no permits simultaneous sessions using the same account. Use individual accounts and certificates so access can be managed separately.
Create a User and Client Certificate
Create the first PPP account, restricted to OpenVPN, and a certificate with TLS client usage. Replace the password placeholder with a unique strong password.
Example output, shortened:
The server will require both valid PPP credentials and a client certificate from this CA. Naming the client CN after the username is an administrative convention; it does not bind that certificate exclusively to the matching PPP account.
Configure the OpenVPN Server and Split Routes
Create a named UDP listener with the server certificate and PPP profile. The explicit cipher must match the client configuration. PAP credentials travel inside the TLS tunnel.
Example output, shortened:
The network-and-netmask route format works across the target versions; some releases may display routes in CIDR form. redirect-gateway=disabled leaves the client's default internet route unchanged. Reconnect clients after changing pushed routes.
Allow VPN Access to the Internal Networks
Add the permitted destinations to an address list. Place VPN-specific forwarding rules before existing drop rules. The final scoped drop prevents VPN clients from reaching other routed destinations through this router.
The internal hosts must have a return path to 10.250.60.0/24. If this MikroTik is their gateway, no extra return route is needed. Otherwise, add that route on the actual LAN gateway via the MikroTik's reachable LAN address. Routed LAN access normally does not require masquerade.
Export the Client Certificate and Encrypted Key
Export only the public CA certificate and the user's certificate/key. Supplying an export passphrase encrypts the exported private key. Use a different passphrase from the VPN account password.
Example output, shortened:
Download these three files through WinBox → Files. The CA private key and server private key are not needed on client devices. After securely assembling and transferring the profile, remove the exported client key file from the router's Files list; this does not delete the installed certificate.
Build the user01.ovpn Profile
Create user01.ovpn as a plain UTF-8 text file. Replace each placeholder with the complete corresponding file contents, including the PEM BEGIN/END lines. Keep the XML-style ca/cert/key tags.
Import the profile into OpenVPN Connect. Enter user01 and the PPP password when connecting. If asked for a Private Key Password, enter the export passphrase from the previous step. Connecting by IP does not require DNS resolution for vpn.example.net; that name is checked against the server certificate.
Verify the Connection
Test from a different internet connection, such as mobile data. Check the assigned address and active tunnel on the router.
Example output, shortened:
On Windows, inspect the route table and test a reachable LAN host. The two internal routes should use the VPN; the ordinary default route should remain local.
Example output, shortened:
If the tunnel connects but a LAN service does not respond, check forwarding rules, the LAN return route and the destination host's firewall. Pushed routes select paths; firewall rules control access.
Optional: Full Tunnel and Internet Masquerade
To send the client's IPv4 internet traffic through MikroTik, push a default-route override. Set DNS servers for the PPP profile and allow VPN-to-WAN forwarding before the scoped VPN drop rule.
In IP → Firewall → NAT, add a srcnat rule for the VPN subnet with Out. Interface List = WAN and Action = masquerade:
Example output, shortened:
Use this dedicated NAT rule if an existing WAN masquerade rule does not already cover the VPN subnet. Place it before any conflicting srcnat rule. Reconnect the client and confirm that its public IPv4 address is now the VPN site's public egress address.
This setup tunnels IPv4 only. Native client IPv6 traffic is not redirected by def1; disable/block it on the client or configure IPv6 tunneling separately when all internet traffic must use the VPN.
To return to split tunneling, stop pushing the default-route override and disable the optional internet-forwarding/NAT rules. The two LAN routes remain pushed:
Reconnect the client. Its internet traffic will again use the local connection, while the listed internal networks remain accessible through OpenVPN.
Add Another User
Repeat the client-certificate and account steps with a new name and unique credentials. For example:
Build user02.ovpn with the same public CA and server directives, replacing the cert/key blocks with user02.crt and user02.key. The shared client pool supports multiple accounts; repeat with user03 and additional users as needed.
References
MikroTik OpenVPN documentation · Certificate management · PPP profiles · NAT