Direct answer: when Minecraft port 25565 is not working, do not add random firewall rules. Work from the inside out: process and listener, server.properties, host firewall, Docker publishing or Pterodactyl allocation, provider firewall, DNS, and—only for a home server—NAT or CGNAT. Fix the first failed layer, then repeat the same test.
Minecraft Java uses TCP 25565 by default; Minecraft Bedrock uses UDP 19132 by default. They are different network paths, so expose only the one required by your edition. The official guides cover setting up a Java server and joining a Bedrock server. The commands below are documented procedures for Ubuntu 24.04 and Debian 12/13; they were not run on your VPS.
Let the symptom choose the first check
| Symptom | What it proves | First layer to inspect |
|---|---|---|
| Connection refused | The path reached a host that rejected the connection. | Stopped process, wrong bind address/port, missing mapping, or explicit reject. |
| Connection timed out | No response arrived before the deadline. | UFW, provider firewall, DNS/AAAA, NAT, CGNAT, or return route. |
| Incompatible version, Outdated client/server | The client already reached a Minecraft application. | Versions, proxy, mods, or compatibility; the port is not the primary fault. |
| Not whitelisted or an authentication error | The network and protocol reached the server. | Whitelist, account, online-mode, or proxy authentication. Do not open more ports. |
Exact wording varies by client, version, and proxy. Pair it with the attempt's log entry: a version or whitelist response is positive evidence that several network layers are already healthy.
Prerequisites and a restore point
- Ubuntu 24.04 or Debian 12/13,
sudoaccess, and a window to restart only the game service. - The real public IP, advertised port, and edition. Keep public, private, container, and allocation addresses distinct.
- The actual server path and service name. This guide uses
/srv/minecraftandminecraft.serviceas examples. - Console or log access plus a second Internet connection for the external test.
Copy server.properties before editing. Adjust the path to match your installation:











