Free — no signup required

P2P and Gaming: "Strict NAT

3 min read

The Multiplayer Headache

Peer-to-peer (P2P) technologies — online gaming, VoIP, BitTorrent, WebRTC video calls — are built on the assumption that two endpoints can establish a direct connection with each other. This assumption collapses under CGNAT.

Why direct P2P fails:

When you connect to a game server (a dedicated server with a public IP), CGNAT isn't a problem — you initiate the outbound connection, the NAT mapping is created, and replies flow back. The problem is when another player needs to connect directly to you, or when two players need to connect to each other without a dedicated server in the middle.

If Player A (behind CGNAT) wants to host a game session, Player B cannot initiate a connection to Player A because Player A has no reachable public IP or port. If both players are behind CGNAT, neither can reach the other directly.

The technical workarounds:

1. STUN (Session Traversal Utilities for NAT)
STUN lets a client discover its own public IP and port as seen from the outside. A STUN server (with a public IP) reflects this information back to the client. The client can then share this "external address" with peers. This works well for regular NAT but fails for CGNAT because the external address belongs to the ISP's edge router, not the customer.

2. ICE + Hole Punching
ICE (Interactive Connectivity Establishment) is a framework used by WebRTC and many games. It tries multiple connection methods in order: direct, STUN-assisted, then TURN relay. "Hole punching" is a technique where both clients simultaneously send packets to each other, tricking their respective NATs into creating mappings. CGNAT breaks hole punching because:
- The ISP's NAT may use port randomization (assigning unpredictable external ports), making it impossible to predict where to punch.
- The ISP's NAT may have endpoint-independent filtering disabled, blocking unsolicited inbound packets even if a mapping exists.

3. TURN Relay Servers
When everything else fails, traffic is relayed through a TURN (Traversal Using Relays around NAT) server with a public IP. Both clients connect outbound to the TURN server, which forwards packets between them. This always works but adds latency proportional to the geographic distance to the relay server and costs the relay operator bandwidth.

What gamers experience:
- PlayStation: "NAT Type 3 (Strict)" — cannot host, limited matchmaking
- Xbox: "Strict NAT" — same restrictions
- PC games: Long matchmaking queues, inability to join friends' sessions, voice chat failures

Key Point: The gaming industry has largely adapted to CGNAT by building relay infrastructure (Sony's, Microsoft's, and Valve's relay networks handle millions of CGNAT users). But this comes at significant infrastructure cost and adds 20-80ms of latency compared to direct connections. For competitive gaming, this latency difference is meaningful.

This is one of 18 chapters

Every chapter is free — Kubernetes, Terraform, SRE, distributed systems, and more — with fast daily review built in.

Sign up free