Skip to content

VPN

A VPN (Virtual Private Network) wraps a device's traffic in an encrypted tunnel to another network. The tunnel hides what is inside it from anyone on the path, including the monitoring you run on your own network. That is the point of a VPN, and it is also what makes one interesting: a VPN client on a workstation moves that workstation's traffic out of reach of every other control, a VPN server on the inside gives whoever holds its keys a way in, and mesh VPNs like Tailscale connect devices to networks nobody asked them to join. Attackers use the same tools for exfiltration and for reaching compromised hosts because the tunnel is encrypted and looks like any other VPN.

Most VPN connections on a network are legitimate. Remote workers, site-to-site links and administrators all use them. The value of seeing them is knowing which ones exist, between which devices, and which ones are new.

Nzyme identifies WireGuard and OpenVPN tunnels and the relay connections of Tailscale from the structure of their packets, without decrypting anything and on any port. You can find all recorded VPN connections on the VPN tab of the Tunnels page under Ethernet in the sidebar of your Nzyme web interface, next to the SOCKS and IPv6 Transition tabs. The Settings tab holds the display settings.

How Nzyme Detects VPN Connections

The taps identify VPN connections in the UDP conversations and TCP sessions they track. A tunnel is tagged as soon as its packets allow an identification, and every later packet of the same connection updates the tunnel's statistics. Nothing is matched on port numbers: a WireGuard tunnel on port 443 is found like one on the default port 51820.

WireGuard

WireGuard has four message types, and each has a fixed structure: a handshake initiation is always 148 bytes, a handshake response 92 bytes, a cookie reply 64 bytes, and a transport data message has a 16 byte header followed by an encrypted payload padded to a multiple of 16 bytes. All four start with a type byte followed by three reserved bytes that are always zero. A UDP conversation in which every datagram fits this layout is a WireGuard tunnel.

The handshake decides the roles. The peer that sends the handshake initiation is the client, the peer that answers with the handshake response is the server. WireGuard renews its handshake every couple of minutes, so even a tunnel that was already running when monitoring started usually shows a complete handshake soon after. Until then, a conversation of at least two consistent transport messages is tracked as a tunnel whose handshake was not observed.

Tailscale is built on WireGuard and sends its own discovery packets (disco) on the WireGuard socket, to find and keep a direct path to a peer. These packets start with a fixed magic sequence and carry the sender's disco key. No other WireGuard implementation sends them, so a tunnel that carries disco packets is recorded with Tailscale as its provider.

OpenVPN

OpenVPN runs over UDP or TCP and starts every session with a control channel handshake: the client sends a hard reset, the server answers with a hard reset that acknowledges the client's session ID, and the TLS handshake of the control channel follows inside further control packets. Once keys are negotiated, the tunnel carries data packets with a short header.

The hard resets have a structure that depends on how the control channel is protected. Nzyme parses all four layouts: the plain, unauthenticated control channel, tls-auth with any of the HMAC sizes OpenVPN supports, tls-crypt, and tls-crypt-v2 with its wrapped client key. A hard reset is only accepted when its packet ID is small, as it must be for the first packets of a session, and when the network time in its replay protection field is within a week of the tap's own clock. A server reset is only paired with a client reset whose session ID it acknowledges. These checks keep random data on a UDP port from being mistaken for a handshake.

Over UDP, a tunnel that was already running when monitoring started is tracked once at least four consistent data packets with the same peer ID were seen in both directions. Over TCP, where Nzyme tracks every session from its first packet, the first packet from the client has to be a hard reset.

Tailscale DERP Relays

Tailscale clients that cannot reach a peer directly relay their WireGuard packets through DERP servers that Tailscale runs. DERP runs inside TLS, so on the wire it is a TLS session to a relay with a hostname of the form derp<region>.tailscale.com, for example derp1.tailscale.com or derp1b.tailscale.com. Nzyme identifies these connections from the server name in the TLS Client Hello and records them with the type DERP, the provider Tailscale and the relay hostname as server name. Self-hosted relays are not recognized.

Every Tailscale client keeps one connection to its home DERP region open at all times, even when all of its peers are reached directly. A DERP connection therefore means a device runs Tailscale. It does not by itself mean that traffic is being relayed.

Handshake Status

Status Meaning
Complete Both sides of the handshake were observed.
Partial Only one side of the handshake was observed.
Not observed Only established tunnel traffic was observed. The tunnel was most likely set up before monitoring started.

The taps record every handshake message they see, independent of the bounded packet buffers that the rest of the identification works on, so a handshake is not missed on a busy tunnel. A handshake whose initiation and response were seen on different ports, which happens when a reply arrives on another port of the same host, is completed on both tunnels and noted as Handshake completed on another port in the tunnel details.

Client and Server

The client is the device that initiated the handshake and the server is the one it connected to. A tunnel that was first seen mid-stream, without a handshake, is recorded with the first observed sender as client. A handshake message of one side turns the roles to what it says. An answered handshake settles them: a WireGuard handshake response that names the initiation it answers, or an OpenVPN server reset that follows a client reset. This happens quickly for WireGuard and at the next reconnect for OpenVPN.

Settled roles stay as they are for as long as the tunnel is in use. Either peer of a WireGuard tunnel can start a later handshake, and this does not change them. A handshake message that is never answered settles nothing, because anyone can send one to any address.

The UDP conversations of a tunnel are recorded with the client of the tunnel as their source. A conversation that is still open when the roles are corrected is corrected with them. Conversations that ended before keep the direction they were recorded with.

An asset gets the role VPN Server from WireGuard and OpenVPN connections with settled roles only. A direct connection between two Tailscale devices has a client and a server in the list, because one of the two started the handshake, but neither device is a VPN server and none gets the role.

Relationship to UDP Conversations and TCP Sessions

Every VPN connection sits on a UDP conversation or a TCP session, which carries the tag WireGuard, OpenVPN or DERP. The tunnel details page links to the underlying session, and the session details page shows the encapsulated VPN connection, the same way it shows other recognized protocols.

A UDP tunnel is long-lived and a UDP conversation is not: the tap starts a new conversation after a few seconds of silence on the same addresses and ports. The tunnel stays one record. Bytes and details of all of its conversations are added up, the identification carries over to the next conversation even when the later packets alone would not allow it, and the tunnel ID stays the ID of the first conversation. A UDP tunnel without any datagrams for 90 seconds is marked as inactive. A TCP tunnel follows the state of its TCP session.

Multiple Taps

Each tap reports the tunnels it has seen, and a tunnel seen by several taps appears once per tap. Use the tap selector to limit the view to a tap.

What Nzyme Reports

Each VPN connection includes:

  • The VPN type: WireGuard, OpenVPN or DERP.
  • The provider, when one could be identified. Currently Tailscale.
  • The server name of a DERP relay.
  • The transport (UDP or TCP), the handshake status and whether the connection is still active.
  • The message types observed, for example HandshakeInitiation and TransportData for WireGuard or HardResetClientV2 and DataV2 for OpenVPN.
  • The client and server endpoints, with MAC and asset context where available.
  • The tunnel ID, the tunneled bytes and the duration.
  • Timestamps of tunnel establishment, most recent activity and termination.

The details page additionally shows what the taps learned from the handshake and the transport. For WireGuard this is the number of handshake initiations and responses, how many used a cookie (which the responder demands when it is under load), the number of transport sessions, the packets in each direction as counted by the sequence counters, how many packets the tap did not see, whether the session existed before observation, and the Tailscale disco keys of both sides. For OpenVPN this is the control channel protection, the session IDs, the clock skew of each side, the peer ID, the number of key renegotiations and the number of data packets.

Working With VPN Connections

The VPN tab lists the connections of the selected tenant that were active at any point in the selected time range. The Active VPN Connections chart shows how many were going on over time, and the Top Servers and Top Clients rankings show which endpoints carry the most connections. The time range and the filters apply to the charts and the list alike. The list and its filters work like every other Ethernet search page, and the small filter icons next to values add that value to the filters. The tunnel ID at the start of each row links to the details page.

The filters can be saved as an Ethernet monitor of type Ethernet VPN Tunnel, which raises an alert when the number of matching connections in a lookback window crosses a threshold. The asset details page of a device lists its Outbound VPN Connections and Inbound VPN Connections.

Questions these views help answer:

  • Which devices run a VPN client? The top clients ranking lists them. A workstation that was never on it before deserves a look.
  • Which VPN servers are in use? The top servers ranking lists them. Filter on a server address to see who connects to it, and on Server MAC Address to find VPN servers inside your own network, which is where inbound access terminates. Such a device has the role VPN Server on its asset details page once a connection with settled roles leads to it.
  • Who runs Tailscale? Filter on Provider being Tailscale. The DERP connections show every Tailscale device, whether or not it currently has a peer.
  • Was a tunnel already there when monitoring started? Filter on Handshake Status being NotObserved.
  • How much data went through a tunnel? Sort by bytes, or filter on Tunneled Bytes above a threshold.

Configuration

Users with the Manage Ethernet Monitoring permission can change the display settings on the Settings tab.

Key Default Description
Exclude Tailscale by default false Open the VPN connections page with a filter that hides connections identified as Tailscale. The filter can be removed like any other, and saved monitors are not affected.

VPN detection is part of Nzyme's UDP and TCP analysis and requires no separate configuration beyond having Ethernet monitoring enabled on the relevant interface. See the Ethernet overview for interface configuration.

Additionally, you can tune pipeline performance in your Nzyme tap configuration files:

[protocols.vpn]
pipeline_size = 256
Variable Description
pipeline_size The tap process moves data internally using in-memory pipelines. You may have to increase this value if you experience high throughput of VPN tunnel updates. (Which is unlikely)

Retention

VPN connections follow the retention time of the Ethernet: Layer 4 data category and are deleted once they have seen no activity for that long. The underlying UDP conversations and TCP sessions follow the same category, but the first conversation of a long-lived UDP tunnel ends long before the tunnel does, so the link from a tunnel to its underlying session can expire before the tunnel itself. See Configuring Retention Times for how to change retention times.