DocsHostingConfiguration

Hosts behind routers

Players can often reach a server whose router doesn't forward its game port. Every listed server registers its game port with up to four master servers, every 20 seconds. When a player's game gets no quick answer from a server, it asks a master to introduce it, again every second for up to 12 seconds. The master tells each side where the other is, and both send a few small packets at once, which opens each router to the other. This is hole punching. The Server Browser's status check, joining and mod downloads all work this way.

The masters only answer STUN and make introductions: the game, voice and mods always go straight between the player and the server. There's nothing to set up for it and no port to open: servers that are listed publicly do it by themselves.

Each side learns what its router does from the answers of two or more masters (STUN), so it knows which ports to try. Which pairs connect:

The server's sideThe player's sideJoins
Public address, forwarded port, UPnP or PCPAnyYes, directly
An ordinary home router (cone NAT)An ordinary home routerYes
Behind the same router as the playerBehind the same routerYes, on local addresses
A new port per destination (symmetric NAT)Cone NAT, full or address-restrictedYes
Symmetric NAT with ports handed out in orderPort-restricted cone NATYes, usually: the player tries the likely ports
Port-restricted cone NATSymmetric NAT with ports in orderYes, usually: the server tries the likely ports
Cone NAT that filters by address aloneSymmetric NATYes
Symmetric NAT with random portsPort-restricted cone or symmetric NATNo
Port-restricted cone NATSymmetric NAT with random portsNo
Symmetric NATSymmetric NATNo, at most by chance
UDP blocked on either sideNo

Not every pair can connect. Two symmetric NATs, common on mobile connections and some providers' shared addresses, can't reach each other, and a pair that can't connect is told so after 12 seconds: no answer from the host: its router and yours let no direct connection through (forwarding the game's port, UPnP or IPv6 on either side would). A server anyone can reach is still the surest way to host: a public address, a forwarded port, upnp = true, or IPv6. Behind a provider's shared address, you may need to ask your provider for a public IPv4 address. Hole punching has been tested through simulated routers so far, not real ones.

  • upnp = true asks the router to forward the servers' UDP ports and the master's TCP and UDP port, through UPnP, or PCP when no router answers UPnP. The mapping is renewed every 45 seconds and removed when dedicated stops. The router's public IPv4 address then becomes the address listed, unless public_address names one. If it fails, the log says Manual setup may be needed.
  • Hidden servers aren't listed and don't register, so players reach them only by Direct Connect, and only directly.
  • Servers that share one public address need different game ports, as they do for forwarding.
  • Masters limit requests to protect themselves and hosts.
  • Behind a shared address: a router that forwards the port but has no public IPv4 address of its own sits behind another NAT, a second router or the provider's shared address (carrier-grade NAT). Players then come in only through the masters' introductions, at the port that NAT chose, which the log says at the start ([online] NAT: …). When that NAT keeps one address for every destination, players can most likely still join from the browser; when it picks a new port for each, some or none can. Leave public_address empty there: the masters' view carries the right port.

Check from another network

If players can't find or join a server, look from a PC with the game on another network, such as a friend's or a phone's hotspot. This asks a master for its list, then asks each server the way the Server Browser does, introductions included, and prints every server that answers with its ping:

Shell
project-reclaimer --list-servers http://148.251.153.44:44340

The Server Browser shows only servers that answer this, and the list names what each server's players need, such as needs Halo 3: ODST or needs the mod "title". project-reclaimer --find-lan lists the servers on your own network the same way. A server that dedicated status shows as running, or that the masters list, can still be out of players' reach. Each server's log says how it fares with the masters:

server.log
[online] listing on http://127.0.0.1:49175, http://148.251.153.44:44340, http://75.98.127.228:44340, http://23.159.176.140:44340
[online] registering with the rendezvous at 148.251.153.44:44340
[online] registered with the server list at 148.251.153.44:44340 as 203.0.113.4:49176
[online] NAT: one address for every destination

The last line is what your router does: one address for every destination is a cone, and a new port for every destination is symmetric, with 2 apart or the like when its ports come in order and in no order when they don't.