RELAYLINK

UDP forwarding guide

Document ID: OPS-002
Status: Active
Version: v1.3.0
Updated: 2026-11-29

Version and Compatibility Scope

RelayLink supports unicast UDP datagram forwarding on both standard cloud-to-private channels and authorized Agent-to-Agent peer mappings. Earlier v0.1.0-rc.8 release notes (rc.8) did not include UDP support; using UDP requires deploying components that support wire protocol v4 or newer—documentation updates on the website never imply new binary packages have been published automatically.

The current Server supports wire protocols v3/v4 as well as v5, allowing you to upgrade the Server first while existing v3 Agents continue TCP forwarding. Unicast UDP requires participating Agents to run v4 or newer; v3 Agents do not receive UDP channels or mappings, and UDP requests involving a v3 endpoint are rejected. If migrating from early builds, note that rebuilt v0.1.0-rc.9 (rc.9) packages incorporated the v3 compatibility fix (earlier artifacts with the same tag still rejected v3), so re-download and verify the latest SHA256SUMS rather than relying on filenames or caches. Legacy channel JSON omitting transportProtocol continues to default to TCP. To enable opt-in P2P preferDirect routing for authorized unicast UDP, both the Server and participating Agents must support v5 direct negotiation (v0.1.0-rc.18 or newer). See the UDP Forwarding Design, Peer Direct and Relay Design, and Verification Status.

Create a Standard UDP Channel

  1. Prepare the Server and Agent per the Installation and Usage Guide, ensuring the target Agent is online and can reach the target UDP service.
  2. In the Server Admin Web UI, create or edit a channel, select UDP (transportProtocol: "udp"), and enter the fixed target host and port reachable from the Agent's network. Do not treat a TCP service port as a UDP service.
  3. Configure the Server's business listen address, listen port, and source-IP security group. TCP and UDP can share the same numeric port; same-protocol listen conflicts are rejected.
  4. Set udpIdleTimeoutSeconds, which defaults to 60 seconds (valid range 1–3600 seconds). Applications send UDP datagrams to the Server's business port, and return datagrams are routed back to the original caller source.

Each caller source IP and port forms an isolated session. The target service sees the Agent's socket address rather than the original caller IP. Successful target socket initialization only indicates local DNS resolution and socket preparation succeeded—it does not prove the target UDP service is online or reachable.

Authorized Agent-to-Agent UDP Access

Create the UDP target channel and outbound peer mapping on the Server; channel policy and authorization remain centrally managed. On the caller Agent's local UI, find the loopback entry labeled UDP and configure your application to send UDP datagrams to 127.0.0.1:<port> rather than opening a TCP connection.

Protocol and idle timeout settings inherit from the target channel, while the caller Agent allocates and persists the local loopback port. Peer access uses inner TLS by default (endToEndEncryptionEnabled = true) so the Server relays only ciphertext; authenticated plaintext relay is used only when an administrator explicitly disables channel encryption (endToEndEncryptionEnabled = false). Protocol changes or effective config edits revoke active sessions and rebuild affected local entries.

Opt-In P2P Prefer Direct (v0.1.0-rc.18)

Authorized unicast UDP channels default to peerRoutingPolicy = "relayOnly" (all traffic relays through the Server). Administrators may explicitly enable peerRoutingPolicy = "preferDirect" on channels where authorizedClientsOnly = true and applicationProtocol = "raw":

  • Encrypted direct (default inner encryption enabled): Each source session opens a dedicated QUIC 1.3 reliable bidirectional stream carrying 4-byte big-endian length-framed datagrams (0–65507 bytes), enforcing target certificate fingerprint pinning and HMAC-SHA256 channel access proof. On Linux, encrypted QUIC direct requires native libmsquic; if unavailable, the Agent automatically degrades peerDirectQuicReady to false and uses encrypted relay.
  • Plaintext direct (encryption explicitly disabled): Each source session opens an authenticated ICE-TCP direct connection carrying length-framed datagrams after bilateral binding and access proof verification.
  • Automatic same-mode fallback and honest boundaries: If either peer lacks direct capability, direct candidates fail or time out (for example, dual symmetric NATs, blocked UDP egress, or private IPs omitted from peerDirect.allowedCidrs), and both control sessions remain healthy prior to admission, the session automatically falls back to same-mode relay, handing off the queued initial datagrams once without duplicate delivery. Authentication failures terminate immediately without fallback. If an already-admitted direct session disconnects, the session closes and cleans up so the next datagram after idle cleanup triggers a fresh authorization; buffered packets are never replayed across paths.

Network and Security

Endpoint Firewall Protocol Notes
Agent control and data ports TCP Uses existing ports (7443/tcp, 7444/tcp); standard forwarding and relay require no public UDP data port
Optional P2P direct probes / STUN UDP / TCP Used only when preferDirect is enabled: allow Server-hosted STUN UDP port if configured; direct data uses UDP/QUIC when encrypted or ICE-TCP when plaintext
Server standard UDP business port UDP Allow only required business sources and attach a source-IP security group
Caller Agent local entry UDP Loopback 127.0.0.1:<port> used by the caller application
Agent to target service UDP Target firewall must permit outbound traffic from the target Agent

Linux Docker Compose uses host networking so business ports need no extra port mapping; custom bridge networks must publish /udp explicitly. Standard UDP tunnels provide no transport-layer encryption—sensitive workloads must use application-level security or default-encrypted peer access. Security groups and firewalls do not replace application authentication.

Datagrams, Timeouts, and Troubleshooting

  • Datagram boundaries are preserved, supporting zero-length payloads up to 65507 bytes. Each source session queues up to 32 datagrams; once full, newly arriving datagrams are dropped rather than queued unboundedly. The udpDroppedTotal counter in Server channel metrics and dashboard views tracks these drops to distinguish between an application not sending and queue-overflow drops.
  • Successful forwarding in either direction refreshes the idle timer (default 60 seconds). Idle expiration frees the session so the next datagram initiates a new session; prior datagrams are never recovered, retried, or replayed.
  • Whether relayed over independent TCP tunnels or carried over preferDirect QUIC / ICE-TCP reliable streams, underlying retransmissions introduce head-of-line blocking within that source session (RFC 9221 QUIC DATAGRAM is not used in the initial release). Applications must still handle timeouts, retries, packet loss, and duplicates—real-time latency or lossless delivery is not guaranteed.
  • RelayLink does not support broadcast, multicast, generic service discovery, or dynamic port rewriting. Forwarding UDP 1434 does not provide SQL Browser named-instance auto-discovery, and real-world RDP UDP compatibility still requires target-environment validation.

When return packets are missing, verify in order that the caller uses UDP, the entry protocol and port match, the target Agent is online, security groups and firewalls permit traffic, and the target Agent can reach the fixed target host/port. When preferDirect is enabled, inspect transportPath (direct_quic, direct_tcp, or relay) in Admin audit records and logs to determine whether traffic used direct transport, fell back to relay, or was filtered by allowedCidrs. Seeing an established session alone does not prove the target service responded. For framing, quotas, and lifecycle details, see the UDP Forwarding Design and Peer Direct and Relay Design.

Repository source