Managed virtual network
Two Linux or macOS clients connect their TUN interfaces over STCP. Give the clients permission to create interfaces and routes. In a Linux container, the client process needs access to /dev/net/tun and CAP_NET_ADMIN. Each interface installs a host route to its peer, using /32 for IPv4 or /128 for IPv6. Use distinct, same-family addresses from an IPv4 private range, the 100.64.0.0/10 shared range, or IPv6 ULA.
Each virtual network carries TCP, UDP, and ICMP only between its two configured endpoints. The interface MTU is 1420 bytes. IPv4 packets must be unfragmented and have no options. IPv6 packets must have no extension headers. These IP addresses belong to the TUN interfaces. The STCP mapping selects the gateway endpoint for the transport connection.
Create the STCP mapping
- Create a Visitor mapping with path
/site-link, TCP ingress, and Private relay (STCP). Select source client A and set its listener to127.0.0.1:17081. Select target client B and set its target to127.0.0.1:17080over TCP. - Before saving, check that A is online and its listener can bind. The mapping uses the gateway endpoint advertised by the server. If A needs a different reachable address, enter it under Gateway connection settings. For example, use
wss://api.tunnel.example.com:9653. Private access example - Save the same network key to
plugin-assets/secrets/site.keyunder each client's data directory. Generate the 64-character hexadecimal key withopenssl rand -hex 32. Restrict read access to the client process. - Under Clients → List, open Details → Plugins and Virtual Networking for each client. Add the matching entry to
virtual_networks. Choose unused IP addresses.
Configure the provider and visitor
Set the provider's listen to the loopback target of the STCP mapping.
{
"virtual_networks": [
{
"role": "provider",
"local_ip": "10.27.0.1",
"destination_ip": "10.27.0.2",
"listen": "127.0.0.1:17080",
"key_file": "site.key"
}
]
}Set the visitor's path to the mapping path and swap the local and destination IP addresses. The virtual networking plugin connects directly to the gateway using the access grant for that path. Both virtual endpoints also authenticate with site.key. The loopback port configured for A is for ordinary TCP access to the mapping.
{
"virtual_networks": [
{
"role": "visitor",
"local_ip": "10.27.0.2",
"destination_ip": "10.27.0.1",
"path": "/site-link",
"key_file": "site.key"
}
]
}Verify the interfaces and routes
After both clients receive the configuration, run ping 10.27.0.1 on the visitor. Check the route with ip route get 10.27.0.1 on Linux or route -n get 10.27.0.1 on macOS. Clients remove the corresponding interfaces and routes when you remove the virtual network configuration or the extension lease expires.
XTCP direct connections
XTCP carries private TCP traffic. Follow the private access example and choose XTCP. In IPv4 deployments, both clients probe the gateway on 9653/UDP by default. Direct QUIC uses mutual authentication with short-lived ML-DSA-87 certificates and MLKEM1024 and TLS_AES_256_GCM_SHA384. A visitor listener that supports reusable sessions can keep up to two direct links. If the primary is unavailable, new connections try an available standby path before using the gateway relay. An HTTP(S) gateway endpoint or an upstream proxy on the visitor uses the relay. Private access example
For an IPv4 listener, the gateway advertises the IPv4 address resolved from host and the UDP probe listener's port. Set p2p_probe to use a dedicated listener. If you publish the port, use the same public port number as the listener. If NAT changes the source port, the receiver checks the gateway-validated IPv4 address, QUIC Retry, and the peer's certificate fingerprint. STUN is off by default. If NAT traversal fails, set TUNNEL_P2P_STUN_SERVER on both clients with up to four reachable, comma-separated host:port entries. With Compose, set it in the client service's environment and recreate the container. Default ports
By default, the visitor starts hole punching on the first application request. Set TUNNEL_XTCP_PREWARM=1 to try opening a direct path as soon as a grant takes effect. Direct negotiation waits up to 3 seconds by default. Direct QUIC sets a one-second keepalive interval and a four-second idle timeout. After falling back to the relay, eligible visitors continue probing with a default minimum retry interval of 15 seconds. An explicit listener retry policy can also cap retries per hour. New TCP connections prefer the direct path once it recovers. Applications must reconnect after a TCP connection drops. Direct transport settings in source
In Runtime Status → Proxy Diagnostics, check the session counts and failure stage under Relay / forwarded sessions and XTCP direct. To inspect one connection, open Tunnel Mappings → Active Links. For a direct XTCP connection, a link-specific cap requires provider support and applies to the selected connection. Active links