Configuring Firewall Rules for Game Servers
Each game server uses specific ports. You must open these in your firewall for players to connect.
Quick Port Reference
| Game | Ports to Open | Protocol |
|---|---|---|
| Minecraft Java | 25565 | TCP |
| Minecraft Bedrock | 19132 | UDP |
| CS2 / CS:GO | 27015, 27020 | TCP+UDP |
| Rust | 28015, 28016 | TCP+UDP |
| Valheim | 2456, 2457 | UDP |
| ARK | 7777, 7778, 27015 | UDP |
| 7 Days to Die | 26900–26902 | TCP+UDP |
| FiveM | 30120 | TCP+UDP |
| Project Zomboid | 16261, 16262 | UDP |
| Palworld | 8211 | UDP+TCP |
| Terraria | 7777 | TCP |
| V Rising | 9876, 9877 | UDP |
| Garry's Mod | 27015, 27005 | TCP+UDP |
| Team Fortress 2 | 27015, 27020 | TCP+UDP |
Opening Ports with UFW
# Open a TCP port:
ufw allow 25565/tcp
# Open a UDP port:
ufw allow 2456/udp
# Open both protocols:
ufw allow 27015
# View all rules:
ufw status numbered
Verify Ports are Open (from an External Machine)
nmap -p 25565 YOUR_SERVER_IP
Look for 25565/tcp open in the output. If it shows filtered, the firewall is blocking it.
Understanding UDP vs TCP
- TCP: Reliable, ordered delivery — used for game control, RCON, file transfers
- UDP: Fast, low-latency — used for real-time game state updates (player positions, combat)