Firewall rules for a game server

Game hosts expose more ports than a website and most of them speak UDP. A tidy rule set keeps players connected and everything else out.

Which ports does my game need open?

Only the ones the server binary actually listens on, which you can read from its configuration or with ss -lnup and ss -lntp once it runs. Defaults are a good starting point, but change them whenever you run several instances on one machine, giving each a separate block of ports.

GameDefault portsProtocol
Minecraft Java Edition25565 (query on the same port if enabled)TCP
Minecraft Bedrock Edition19132 IPv4, 19133 IPv6UDP
Counter-Strike 2 and other Source titles27015 game, 27020 SourceTVUDP, plus TCP 27015 for RCON
Rust28015 game, 28016 RCON, 28082 app companionUDP game, TCP RCON and companion
Valheim2456 to 2458UDP
ARK: Survival Ascended7777 game, 27015 queryUDP

Can you show a complete game host policy?

Default-deny like any server, with explicit openings per game. Here is an nftables example for a host running one Rust and two Valheim worlds, with SSH limited to an administrator address:

table inet gamefw {
  set admins { type ipv4_addr; elements = { 198.51.100.20 } }
  chain inbound {
    type filter hook input priority -10
    policy drop
    iif "lo" accept
    ct state vmap { established : accept, related : accept, invalid : drop }
    meta l4proto { icmp, ipv6-icmp } limit rate 10/second accept
    ip saddr @admins tcp dport { 22, 28016 } accept
    udp dport 28015 accept
    tcp dport 28082 accept
    udp dport { 2456-2458, 2466-2468 } accept
  }
}

RCON and web admin panels should never be open to the world. Limit them to your own addresses or reach them through an SSH tunnel; the Company VPN gateways page shows how a WireGuard tunnel can carry admin traffic instead.

How do I stop my server being used for reflection attacks?

Rate-limit answers on query ports. Many game protocols reply to a small unauthenticated query with a much larger packet, and attackers spoof a victim's address to turn your server into an amplifier. A per-source limit on new UDP flows to the query port keeps legitimate server browsers working while making the host useless for abuse.

nft add rule inet gamefw input udp dport 27015 meter q4 { ip saddr limit rate 20/second burst 40 packets } accept
nft add rule inet gamefw input udp dport 27015 drop

Keep the game software updated too: several engines have patched amplification bugs in recent years.

Does the firewall protect against DDoS attacks?

Not on its own. A host firewall drops packets after they arrive at your port, so a flood larger than the port is still a flood. That part is handled upstream: every machine sits behind DDoS filtering that inspects traffic before it reaches you, which is included at no extra cost. Your rules complement it by removing whatever is left, such as connection spam to closed ports or slow floods aimed at one game port. The DDoS protection on bare metal article explains how the two layers work together.

Will strict rules add lag?

No measurable amount when the rules are written well. Put the established,related rule near the top so ongoing player traffic matches on the first lines, use sets rather than long lists of single rules, and avoid logging every dropped packet on a busy port. On a modern processor the per-packet cost of a dozen nftables rules is a few hundred nanoseconds, far below network jitter. Choose the location for latency instead: players notice the distance to Frankfurt or Beauharnois long before they notice the firewall.

Which machine suits a game host?

One with high single-thread speed and a large cache, because most game simulations run their main loop on one core. The Game line carries X3D processors with stacked cache: GAME-1 2026 has the AMD Ryzen 7 9800X3D for $198.60 a month. For smaller communities, ESSENTIAL-GAME-1 offers 6 cores and a guaranteed 1 Gbps port in Europe, and the Singapore and Sydney versions include a monthly traffic allowance at 250 Mbps.

How do I keep rules tidy across many instances?

Give every instance a fixed port block and record it in one file. A naming habit such as base port plus ten per instance avoids collisions; generate the nftables sets from that file with a short script, reload with nft -f, and keep the file under version control. When an instance is retired, removing its block from the file removes its openings from the firewall. The Game server hosting page covers capacity planning for whole fleets.

Machines built for game hosting

ModelProcessorCoresMemoryDrivesPortPer month
GAME-1 2026AMD Ryzen 7 9800X3D864 GB2x 960 GB SSD NVMe1 Gbps unmetered$198.60
GAME-2 2026AMD Ryzen 9 9950X3D1664 GB2x 960 GB SSD NVMe1 Gbps unmetered$222.60
ESSENTIAL-GAME-1AMD Ryzen 5 5600X632 GB2x 512 GB SSD NVMe1 Gbps unmetered$43.20
ESSENTIAL-GAME-2AMD Ryzen 7 5800X864 GB2x 960 GB SSD NVMe1 Gbps unmetered$60.00
ESSENTIAL-SAMD Ryzen 7 9700X864 GB2x 512 GB SSD NVMe1 Gbps unmetered$46.20

Related pages

Game server hosting

Ryzen X3D and Ryzen 5000 machines for Minecraft, Rust, CS2 and FiveM worlds that need steady tick rates.

Read more

Game servers

AMD Ryzen X3D processors with large L3 cache for game servers.

from $198.60 a monthRead more

Build an iptables firewall

A default-deny host firewall with iptables or nftables: allow SSH and web, rate-limit new connections, cover IPv6 and keep the rules across reboots.

Read more

DDoS protection on bare metal

How network edge filtering stops volumetric attacks before they reach your port, and what you still handle yourself.

Read more

Questions and answers

What ports must be open for Minecraft?

Java Edition uses TCP 25565 by default. Bedrock Edition uses UDP 19132 for IPv4 and 19133 for IPv6.

Should RCON be reachable from the internet?

No. Restrict RCON and admin panels to your own addresses or reach them through an SSH or WireGuard tunnel.

Is DDoS protection included for game servers?

Yes. Every machine sits behind DDoS filtering at no extra cost. The host firewall adds a second layer for traffic that gets through.

Do firewall rules increase ping?

Not noticeably. A short nftables rule set with an early established rule adds well under a microsecond per packet.

How do I run several game instances on one machine?

Give each instance its own block of ports, open those blocks in the firewall and keep the list in one file so rules stay in step.