Launch sale10% off everything - celebrating the launch of GHosting!
← All guides

Project Zomboid Server Ports & Firewall Rule Generator

Free port-rule generator

Get the rules for your server's ports

Use the defaults or enter the two ports in your active server ini. They can be non-consecutive. This generates configuration; it does not test a connection.

1. Server ini

Stop the server and replace these two lines in the active Server/<name>.ini.

DefaultPort=16261
UDPPort=16262

2. Host firewall

For a Linux host using UFW:

sudo ufw allow 16261/udp
sudo ufw allow 16262/udp
Windows PowerShell alternative

Run as Administrator on the server PC.

New-NetFirewallRule -DisplayName "Project Zomboid UDP 16261,16262" -Direction Inbound -Action Allow -Protocol UDP -LocalPort 16261,16262

3. Router port forwarding

Forward each public UDP port to the same port on the server's reserved LAN IP.

Two separate UDP forwarding rules
Public portLocal portProtocol
1626116261UDP
1626216262UDP

No IP address is needed here. Port choices stay in this page. RCON is separate and is not needed for players to join. A firewall rule cannot bypass ISP CGNAT.

Test the running server from outside your network. A Steam query response does not prove the separate direct-connection port works; have a friend test joining too.

Prefer a server with the network already managed?

GHosting allocates your ports and configures the public forwarding. Manage settings, Workshop mods and the console from your browser.

See Project Zomboid server options

A Project Zomboid dedicated server can look healthy in its console and still be impossible to join. The usual cause is not SteamCMD or Java. It is that the server uses two separately configured UDP ports, or that it quietly loaded a different configuration directory than the one you edited.

The quick answer is: set DefaultPort=16261, set UDPPort=16262, allow and forward both UDP ports, and write a custom cache directory as -cachedir=/path/to/data with an equals sign.

Use the generator above to make matching rules for your actual ports, including non-consecutive custom ports. It runs in your browser without an IP address or account. After applying the rules and starting the server, our free game server port checker can test its Steam query response from the public internet. That is one network check, not proof that the separate direct-connection port or every player connection works.

A fortified Project Zomboid base running on a persistent dedicated server Run Project Zomboid without managing ports by hand

The two ports do different jobs

  • DefaultPort is the game and Steam-facing port. The default is UDP 16261.
  • UDPPort is Project Zomboid's separate RakNet port. The usual default is UDP 16262.

They are independent settings in the server ini file. Treating the second port as an automatic side effect is risky: explicitly set both values, then make the firewall and router rules match them. Opening only 16261 can leave the server visible without a working player connection. Opening only 16262 leaves Steam discovery and the initial connection path on the wrong port.

How to port forward a Project Zomboid server

Router menus use different names, but the path is always internet to router, router to the server machine, then host firewall to Project Zomboid. Configure every layer in this order:

  1. Reserve the server machine's private IP. Give it a DHCP reservation in the router so an address such as 192.168.1.50 does not move after a reboot. A forwarding rule aimed at yesterday's address will quietly stop working.
  2. Set both ports in the active ini. Stop the server, then set DefaultPort=16261 and UDPPort=16262 in the ini that belongs to the server name you actually launch.
  3. Allow both through the machine's firewall. They are UDP rules, not TCP rules. With UFW, sudo ufw allow 16261:16262/udp opens the pair. In Windows Defender Firewall, create an inbound UDP rule for 16261-16262.
  4. Create two router forwarding rules. Forward public UDP 16261 to UDP 16261 at the reserved private IP, then public UDP 16262 to UDP 16262 at the same address. Choosing a combined TCP/UDP rule is unnecessary.
  5. Start the server and wait for the world to load. Confirm that the process is listening on both ports before testing the router. If it still listens on the defaults after you chose custom ports, it loaded a different ini.
  6. Test from outside the network. Use a phone on mobile data, ask a friend, or use the external port checker. A test from the server machine or the same Wi-Fi does not prove the forward works.

If the router's WAN address is private, or it does not match the public address seen from the internet, there is another NAT layer upstream. That is common with CGNAT and some modem-router combinations. A rule on your own router cannot cross that outer layer: ask the ISP for a public IPv4 address, put the upstream modem into bridge mode when appropriate, or run the server on a host with a public address.

Where the settings live

For a server named servertest, the main file is normally Zomboid/Server/servertest.ini below the server user's home directory. If you launch with -servername gh, the file becomes Server/gh.ini inside the active Zomboid data directory.

That last phrase matters. Project Zomboid has an installation directory containing the executable and a separate data directory containing the ini, world, database, logs, and mods. Editing an ini beside the executable does nothing unless the server was explicitly told to use that location.

The -cachedir syntax that fails silently

The safe form is -cachedir=/srv/project-zomboid/data. The equals sign is required. Unlike -servername gh, writing -cachedir /srv/project-zomboid/data with a space can be ignored. The server then falls back to the default Zomboid directory under the service user's home.

This creates a particularly confusing failure: you edit ports in one ini, start the server, and see a running Java process, but it binds to 16261 and 16262 because it read a different ini. Search the startup log for the cache directory, then check which Server folder changed most recently.

A reliable custom-port example

Suppose the router gives this server UDP 2200 and 2201. Use DefaultPort=2200 and UDPPort=2201 in the same ini. Launch the matching server name with an explicit cache directory, allow UDP 2200 and 2201 through the host firewall, and forward both router ports to the server machine.

The numbers do not technically have to be consecutive, but a consecutive pair is easier to allocate and reason about. What matters is that neither port overlaps another process and every layer uses the same two values.

Running several Project Zomboid servers

Every instance needs its own server name, cache directory, database, and two unique UDP ports. A clean allocation looks like this:

  • Server A: DefaultPort 2200, UDPPort 2201
  • Server B: DefaultPort 2202, UDPPort 2203
  • Server C: DefaultPort 2204, UDPPort 2205

Do not leave every instance on UDPPort 16262 while changing only DefaultPort. The first server will take the RakNet port and the others will fail or behave unpredictably. Give each service its own data directory so worlds, player databases, settings, and Workshop mods cannot bleed into another instance.

How to check what is actually listening

On Linux, run ss -lunp while the server is up and look for both configured UDP ports. On Windows, use netstat -ano -p udp. A process bound to the correct ports proves the application side is ready; it does not prove the router or upstream firewall is forwarding internet traffic.

Test from outside the home network. Connecting from the same LAN can be misleading because some routers do not support NAT loopback. If LAN works and an external client does not, focus on port forwarding, the host firewall, CGNAT, or the public IP rather than reinstalling the game.

Port troubleshooting checklist

  • Confirm the server name selects the ini you edited.
  • Use -cachedir=/path, not a space after -cachedir.
  • Set both DefaultPort and UDPPort explicitly.
  • Verify both UDP ports are listening before checking the router.
  • Allow both ports in the operating-system firewall.
  • Forward both ports to the server machine's current private IP.
  • Test from a different network and rule out ISP-level CGNAT.

What about RCON?

RCON is remote administration, separate from the two UDP player ports. Players do not need it to join. If you enable RCON yourself, give it a strong password and restrict access to trusted administrators rather than adding it to the public player rules. The generator deliberately includes only the two player ports.

How GHosting handles the ports

GHosting allocates a non-overlapping three-port span for every Project Zomboid instance: the two UDP player ports plus a separate RCON port. It writes DefaultPort and UDPPort independently, keeps each server in its own cache directory, and verifies that the game reaches a running state before presenting the address. The same configuration path also caps the stock 16 GB Java heap to the RAM actually assigned to the server.

The Indie Stone explains the separate UDP connection paths in its server networking notes. Use the values in your running server's ini rather than assuming the default numbers also apply to a rented server.

If you are also adding Workshop content, read WorkshopItems vs Mods explained. For the full self-hosting path, see the Project Zomboid dedicated-server guide. Or choose a managed Project Zomboid server with both ports and Workshop handling already wired.