Concepts / Address translation

Address translation

UDP hole punching

Also called hole punch, simultaneous open, TURN, relay, DERP, peer-to-peer

Two peers behind NAT sending to each other at once, so each router takes the other's packets for replies.

Each peer learns the other's public address and port (from STUN, through a rendezvous server) and sends to it from the same port. Its own router now has an entry expecting replies from the peer, so the peer's packets, arriving at the same time, get in. The first packets may be lost before both entries exist, and the hole closes when the entry times out unless keepalives keep it open. WebRTC, VoIP, games and Tailscale connect this way. Behind a symmetric NAT it fails, and traffic goes through a relay (TURN, RFC 8656), which always works but costs a detour.

See it on real machines

Learn it on real machines.

Every lab is a small network of real Linux machines in your browser. Start with a free account: Google or email, no card.

Open this lab