Managed infrastructure for SMBs
Game Server Ports Explained: TCP vs UDP and How to Check a Port From Outside
The short answer
Every game server listens on one or more ports, and each port uses either TCP or UDP. If the protocol or the number is wrong anywhere between the player and the server, the game says it cannot connect even though the server is running fine. Most connection problems come down to four checks: the server is actually listening on the port you think, the firewall on the server allows it, any router or cloud firewall in front of it forwards or allows it, and you tested from outside your own network. This guide walks through each check in order, explains why UDP is harder to test than TCP, and ends with a checklist you can run before you share an address with players.
1. TCP and UDP in plain terms
TCP sets up a connection first and confirms every packet arrives, which is why websites, logins and Minecraft Java Edition use it. UDP just sends packets and does not wait for confirmation, which keeps latency low, so many action and survival games use it for gameplay traffic. The same port number on TCP and on UDP are two different doors. Opening TCP 27015 does nothing for a game that needs UDP 27015, and that single mix-up causes a large share of "my friends cannot join" reports.
2. Find the exact ports your game needs
Check the game's official server documentation, not a forum post from years ago, because ports change between versions. A few common defaults:
- Minecraft Java Edition: TCP 25565.
- Minecraft Bedrock Edition: UDP 19132.
- Valheim: UDP 2456 and 2457.
- Terraria: TCP 7777.
Many games also use a separate query port for the server browser and a separate port for remote admin tools. Write down every port with its protocol and its purpose. If you only open the game port, players may connect by address but never see the server in the in-game list.
3. Confirm the server is listening
On a Linux server, run ss -tulpn and look for the port number. The first column shows tcp or udp, and the local address column shows where it is bound. If you see 127.0.0.1 the server only accepts connections from the machine itself, so change the bind address to 0.0.0.0 or the server's public address in the game's config file. If the port is not in the list at all, the problem is the server process, not the network, so read the server log before touching any firewall.
4. Check the firewall on the server
Linux servers often run UFW, nftables or firewalld. Allow only the ports the game needs, with the right protocol, for example ufw allow 2456:2457/udp or ufw allow 25565/tcp. Keep SSH and admin ports limited to your own address where you can. Our guide to Linux VPS firewalls with UFW and nftables covers safe defaults and how to avoid locking yourself out.
5. Check what sits in front of the server
Hosting at home means the router must forward the port to the machine running the server, with the matching protocol. Many home connections also sit behind carrier grade NAT, where your router does not own a public address at all; if the address on your router's status page does not match what a "what is my IP" site shows, port forwarding cannot work and you need a hosted server or a tunnel. On a VPS or dedicated server, check any cloud or provider firewall in your control panel as well as the one inside the operating system. A managed host or game panel usually handles this layer for you and shows the address and port to share.
6. Test TCP from outside your network
Testing from the same network as the server proves very little, because traffic never leaves your house or data center. Use a phone on mobile data, a friend's connection or a second server elsewhere. For TCP, nc -zv 203.0.113.10 25565 prints "succeeded" or "open" when the port answers. Online port checkers also work for TCP. If the test fails from outside but works on the server itself, the block is in a firewall or the router, not the game.
7. Test UDP the honest way
UDP has no handshake, so a basic port checker cannot tell whether a port is open or just silent. Commands like nc -zuv or nmap -sU often report "open|filtered", which means "no reply," not "working." The reliable UDP test is the game client itself, or the game's own query tool, run from outside your network. Another useful check is to run tcpdump -ni any udp port 2456 on the server while a friend tries to connect: if packets show up, the network path is fine and any remaining problem is inside the game server.
8. Rule out the usual suspects
- The port is open on TCP but the game needs UDP, or the other way around.
- The server restarted on a different port after an update or a config change.
- The router forwards to an old local address because the machine got a new one; give it a fixed local address in the router.
- Players type the wrong format; see how friends join with IP and port.
- Version mismatch between client and server, which some games report as a connection failure.
9. Keep exposure small
Open only the ports the game needs and close test ports when you are done. Never expose database, RCON or panel ports to the whole internet; limit them to your own address or reach them over a VPN or SSH tunnel. Keep the server software updated, because an open port running an old version is the easiest way in for attackers.
Before you share the address checklist
- Every required port is written down with TCP or UDP and its purpose.
ss -tulpnshows the server listening on each port, not only on 127.0.0.1.- The server firewall allows those ports with the right protocol and nothing extra.
- The router or provider firewall forwards or allows the same ports.
- TCP ports tested from outside with
ncor a port checker. - UDP ports tested with the real game client from outside.
- Admin and database ports are not reachable from the open internet.
Next steps
If you would rather not manage routers, firewalls and port checks yourself, Glass Gaming, powered by GlassHosting, runs game servers on our own network with the address and port ready to share. For studios and businesses, GlassHosting is a managed service and infrastructure provider: we run your servers on our own network, so you can run your business. Browse supported games or see plans.
Host with GlassHosting
Order a plan or browse the knowledgebase for deeper how-tos.