Skip to content
uencoder

Hole Punching

Hole punching is a P2P NAT traversal technique in which both peers send packets to each other's public endpoints, making each NAT create an outbound mapping that admits the other peer's inbound packets.

Purpose

It lets two peers behind NATs establish a direct P2P connection without a relay server, cutting latency and server load.

Mechanism

Both peers learn their public endpoints via STUN and exchange them. Each peer sends to the other's public endpoint (creating an outbound mapping in its own NAT); the peer's NAT sees the packet arriving from a mapped endpoint and lets it through.

Use cases

  • Direct P2P connections
  • WebRTC ICE
  • Gaming and VoIP

Related tools

References