OpenVPN: what the protocol is and how it works

OpenVPN is an open-source VPN protocol and program that agrees on keys through a TLS handshake and then carries encrypted IP packets, or Ethernet frames, in its own packet format over UDP or TCP. A client is set up with one .ovpn text file that usually holds the server address, the certificates and the keys. It has existed since 2001 and runs almost everywhere, and it is easy to recognise: a 2022 study identified over 85% of OpenVPN flows on a real ISP's network.

Updated

On this page

Facts

What it is

VPN: TUN for IP packets, TAP for Ethernet frames

Since, by

James Yonan, 2001; now OpenVPN Inc. and the community

Transport

UDP by default, or TCP

Encryption

TLS for keys; AES-GCM or ChaCha20-Poly1305 for data

To the network it looks like

Its own header: an opcode byte, TLS inside

Usual port

1194 assigned by IANA; any UDP or TCP port

Comes as

.ovpn text file with certificates and keys inline

License

GPLv2 for OpenVPN 2.x

Latest release

openvpn v2.7.9, November 5, 2026

In Veli

Windows, Linux · file

Own server from the app

Yes

Versions and history

  1. 2001

    Version 0.90

    The first release on 13 May 2001: an IP tunnel over UDP with the Blowfish cipher and an SHA1 HMAC.

  2. 2002

    1.0 brings TLS

    OpenVPN 1.0 of March 2002 adds TLS-based authentication and key exchange, the design it keeps today.

  3. 2005

    2.0 and port 1194

    OpenVPN 2.0 comes out in April 2005. From 2.0-beta17 the default port is 1194, assigned by IANA; earlier versions used 5000.

  4. 2016

    2.4: AES-GCM and tls-crypt

    Data ciphers are negotiated, AES-256-GCM by default; P_DATA_V2 with a peer ID lets a client change address without a new handshake; tls-crypt encrypts the control channel.

  5. 2020

    2.5: ChaCha20 and tls-crypt-v2

    ChaCha20-Poly1305 for data, data-ciphers in place of ncp-ciphers, a key per client with tls-crypt-v2. BF-CBC leaves the default cipher list.

  6. 2023

    2.6: data channel offload

    OpenVPN 2.6.0 can hand the data channel to a kernel module (DCO), with the driver in the Windows installer. ChaCha20-Poly1305 joins the default list, and cipher is ignored in TLS mode.

  7. 2026

    2.7 and the kernel's ovpn module

    Linux 6.16 has its own DCO module, ovpn, and it works only with OpenVPN 2.7 and later, released in February 2026.

How OpenVPN works

OpenVPN runs two channels over one UDP or TCP connection. The control channel carries a TLS handshake: certificates are checked, a user name and password can be sent, and the keys for the data channel are agreed. TLS needs reliable delivery and UDP doesn't give it, so OpenVPN wraps TLS records in its own control packets with numbers, acknowledgements and retransmission.

The data channel carries your traffic, encrypted with the agreed keys, which are renegotiated every hour by default (reneg-sec 3600). With dev tun it carries IP packets; with dev tap it carries Ethernet frames, which can bridge two networks but isn't supported by every client.

The server manages its clients: it pushes the tunnel address, routes and DNS servers, and it can check passwords and second factors through plugins or scripts.

Packets on the wire: the opcode byte

Every OpenVPN packet starts with one byte that holds the opcode in its top five bits and a key ID in the bottom three. Over TCP a two-byte length comes first. With the usual key ID 0, the first bytes of a session are predictable:

  • 7

    First byte0x38

    NameP_CONTROL_HARD_RESET_CLIENT_V2

    When it appearsThe client's first packet

  • 8

    First byte0x40

    NameP_CONTROL_HARD_RESET_SERVER_V2

    When it appearsThe server's reply

  • 10

    First byte0x50

    NameP_CONTROL_HARD_RESET_CLIENT_V3

    When it appearsThe first packet with tls-crypt-v2, carrying the client's wrapped key

  • 4

    First byte0x20

    NameP_CONTROL_V1

    When it appearsTLS handshake records

  • 5

    First byte0x28

    NameP_ACK_V1

    When it appearsAcknowledgements of control packets

  • 9

    First byte0x48

    NameP_DATA_V2

    When it appearsYour data, with a 3-byte peer ID (2.4 and later)

  • 6

    First byte0x30

    NameP_DATA_V1

    When it appearsYour data from older peers

tls-auth, tls-crypt and tls-crypt-v2

Three optional settings protect the control channel with a pre-shared key. They decide whether a stranger gets any answer and how much of the handshake a network can read.

  • tls-auth

    What it addsAn HMAC on every control packet: the manual calls it an “HMAC firewall”. Unsigned packets are dropped without reply.

    What stays readableEverything: the TLS handshake and the certificates travel in the clear

  • tls-crypt (2.4)

    What it addsEncrypts and authenticates control packets with a key all clients share. Hides the certificate and makes OpenVPN harder to identify.

    What stays readableThe opcode, the 8-byte session ID and the packet ID

  • tls-crypt-v2 (2.5)

    What it addsA key per client. The client sends its key, wrapped by the server's key, in its first packet, so the server can refuse it before TLS starts.

    What stays readableThe same header, and opcode 10 in the first packet

Data ciphers and DCO

Data ciphers are negotiated: the client lists what it supports, and the server picks the first match from its data-ciphers. In 2.6 the default list is AES-256-GCM:AES-128-GCM:CHACHA20-POLY1305, the last one where the TLS library has it. BF-CBC, the old 64-bit-block default, left that list in 2.5, and OpenSSL 3 offers it only with its legacy provider.

DCO (data channel offload), added in 2.6.0, moves encryption and forwarding of your packets into a kernel module, and the program keeps only the control channel. On Windows the driver ships with the official installer from 2.6.0; on Linux the ovpn module is part of the kernel from 6.16 and works with OpenVPN 2.7 and later. DCO needs dev tun, an AEAD cipher and no compression; with other settings OpenVPN switches it off and says so in the log.

The .ovpn file, line by line

client.ovpn
client
dev tun
proto udp
remote 203.0.113.10 1194
resolv-retry infinite
nobind
remote-cert-tls server
data-ciphers AES-256-GCM:CHACHA20-POLY1305
auth-user-pass
verb 3
<ca>
-----BEGIN CERTIFICATE-----
...
-----END CERTIFICATE-----
</ca>
<cert>
...
</cert>
<key>
...
</key>
<tls-crypt>
-----BEGIN OpenVPN Static key V1-----
...
-----END OpenVPN Static key V1-----
</tls-crypt>

Values are examples. The blocks can also be separate files: ca ca.crt, cert client.crt, key client.key.

  • client

    What it meansShort for pull and tls-client: take settings from the server and act as the TLS client.

  • dev tun

    What it meansAn IP tunnel. dev tap carries Ethernet frames, and then both ends must use it.

  • proto udp

    What it meansTransport. UDP is the default; tcp makes the client connect over TCP, and the server must listen on TCP.

  • remote 203.0.113.10 1194

    What it meansServer and port; a third word can set the protocol. Several remote lines are tried in turn.

  • resolv-retry infinite, nobind

    What it meansKeep retrying the server's name; don't hold a fixed local port. In 2.6 both are already the default for a client.

  • remote-cert-tls server

    What it meansAccept only a certificate marked for server use, so another client's certificate can't pose as the server.

  • data-ciphers

    What it meansData ciphers this client accepts. The older cipher line is ignored in TLS mode from 2.6 on.

  • auth-user-pass

    What it meansThe server also wants a user name and password; with a file name after it, they are read from that file.

  • <ca>, <cert>, <key>

    What it meansThe certificate authority, the client certificate and its private key, pasted into the file.

  • <tls-crypt>

    What it meansThe key that wraps the control channel. Other setups have <tls-auth> with key-direction 1, or <tls-crypt-v2>.

What a censor sees

  • The opcodes. In “OpenVPN is Open to VPN Fingerprinting” (Diwen Xue and co-authors, USENIX Security 2022) a filter read the opcode byte of the first packets: a client reset, a server reset, then a few kinds of control and ACK packets. Plain OpenVPN shows this sequence over both UDP and TCP.
  • The ACKs. Acknowledgements are all one size and appear only during the handshake. That second fingerprint still works when the opcode byte is scrambled with an XOR patch.
  • Probing. With tls-auth or tls-crypt the server doesn't answer strangers, but the researchers still told OpenVPN servers apart by timing over TCP: a 16-byte client reset is dropped at once, while the same bytes minus one make the server wait for the rest.
  • The result. At Merit, a regional ISP serving about a million users, the framework identified over 85% of OpenVPN flows with negligible false positives, 1,718 of 2,000 test flows, and connections to 34 of 41 “obfuscated” VPN configurations sold by commercial providers.
  • tls-crypt and port 443 don't hide it: the opcode byte stays in the clear, and TCP on 443 is still not HTTPS, even with port-share passing other visitors to a web server.
  • In practice: from 7 August 2023 users of several Russian mobile networks reported OpenVPN over UDP and TCP, port 443 included, being cut together with WireGuard (net4people #274).

Strengths and weaknesses

Strengths

  • Runs over UDP or TCP on any port, so it fits networks that pass only TCP.
  • Access the server controls: certificates that expire and can be revoked, passwords, second factors through plugins.
  • The server pushes addresses, routes and DNS, so client files rarely need editing.
  • Clients exist for all major systems, and TAP mode can bridge Ethernet networks.

Weaknesses

  • Recognised by DPI from the first packets: opcodes, ACK sizes, probe timing.
  • Over TCP it stalls on packet loss, because TCP runs inside TCP.
  • Without DCO every packet goes through a user-space program, which costs throughput.
  • Hundreds of options: an old cipher or compression can be left on by mistake.

Where it works

Programs and servers from our comparison tables that list this protocol.

Clients

  • AmneziaVPN
  • podkop

Servers and panels

  • Hiddify Manager
  • PiVPN

Compare these programs

Sources

How we write and check

In Veli

OpenVPN in Veli

Veli connects OpenVPN on Windows and Linux: Profiles → Add → “Open a file” takes the .ovpn, and if the server wants a login, Home shows the user name and password fields. On Windows the app installs OpenVPN itself when a profile needs it; on Linux it uses the system's openvpn package. On macOS and Android Veli doesn't connect OpenVPN, and the app says so when you add the file. On a computer the “Apps and sites” rules for OpenVPN work by IP address only.

“Own server” installs OpenVPN on your VPS over SSH, next to the other protocols, and each device gets an .ovpn file with its keys inside.

Questions

Should OpenVPN use TCP or UDP?

UDP, the default, unless the network passes only TCP. Over TCP a lost packet is repeated by both the inner and the outer TCP, and the tunnel stalls; TCP on 443 passes web-only firewalls but is still recognisable.

What port does OpenVPN use?

1194, assigned to OpenVPN by IANA and the default since 2.0-beta17 (earlier versions used 5000). Any UDP or TCP port can be set with port on the server and in the remote line.

Can OpenVPN be detected and blocked?

Yes, easily. Researchers at USENIX Security 2022 identified over 85% of OpenVPN flows on an ISP with a million users, and in August 2023 Russian mobile networks were reported cutting it.

What is the difference between tls-auth and tls-crypt?

tls-auth signs control packets so the server ignores strangers; tls-crypt also encrypts them and hides the certificate. tls-crypt-v2 gives every client its own key.

What is OpenVPN DCO?

Data channel offload: from 2.6 the encryption of your traffic can run in a kernel module instead of the OpenVPN program, which is faster. It needs dev tun and an AEAD cipher such as AES-GCM.

How is OpenVPN 3 different from OpenVPN 2?

OpenVPN 3 is the client library inside OpenVPN Connect. It speaks the same protocol as 2.x, but it has no server part, and OpenVPN Connect doesn't support dev tap.