NAT Traversal
NAT traversal is the set of tricks two devices behind separate routers use to open a direct connection anyway.
NAT traversal describes the techniques two devices behind network address translation use to establish a direct connection despite neither having a public, routable address of its own. Network address translation lets many devices on a private network share one public IP, which is why home internet works at all under IPv4 scarcity — but it also means an unsolicited inbound packet usually has nowhere to go, since the router has no mapping for it yet.
The classic fix is hole punching: both peers first send outbound packets to a public rendezvous server, which tells each peer the other's observed public IP and port. Each peer then sends a packet directly to the other's address. The outbound packet from each side creates a temporary mapping in its own NAT, and if timing lines up, the "unsolicited" inbound packet from the peer arrives just after that mapping opens and slips through. This is the mechanism behind most Peer-to-Peer connections and underlies WebRTC's ICE negotiation.
STUN servers tell a device what its own public IP and port look like from the outside — necessary because NAT rewrites both. TURN servers are the fallback when punching fails: a relay that both peers connect to normally, sacrificing the direct-connection latency win for guaranteed connectivity. ICE (Interactive Connectivity Establishment) is the algorithm that tries several candidate paths — host, STUN-reflexive, TURN-relayed — and picks the best one that actually works, coordinated through a Signaling Server that carries none of the media itself, only the negotiation.
Some NATs are more hostile than others: "symmetric" NATs assign a different external port per destination, which breaks the simplest hole-punching approach and often forces TURN.
See also5
WebRTC
The browser standard for direct peer connections carrying audio, video, and arbitrary data.
Networks & Distribution12 connections
Signaling Server
The small coordination service peers use to find each other before connecting directly.
Networks & Distribution7 connections
Peer-to-Peer
An architecture where participants communicate directly rather than through a central server.
Networks & Distribution11 connections
IPv6
IPv6 exists mainly to end address scarcity, with a large enough space that per-device NAT becomes optional.
Networks & Distribution8 connections
Anycast
Anycast announces the same IP address from many locations and lets normal routing send each client to the nearest one.
Networks & Distribution6 connections