What's a port? Common ports at a glance
If the server IP is the "building address", a port is the "unit number". Even on the same server, each program accepts connections on its own port — for example, 443 for a website and 25565 for Minecraft. When you can't connect from outside, it's usually because the port is blocked or the program isn't listening on that port.
Common ports
| Port | Used for | Open to the outside? |
|---|---|---|
| 22 (TCP) | SSH access to Linux servers | Open (default) |
| 3389 (TCP) | Windows Remote Desktop | Open (default) |
| 80 (TCP) | Website (HTTP) | When you run a website |
| 443 (TCP) | Website (HTTPS) | When you run a website |
| 25565 (TCP) | Minecraft Java Edition | When you open a Minecraft server |
| 19132 (UDP) | Minecraft Bedrock Edition | When you open a Bedrock server |
| 3306 (TCP) | MySQL / MariaDB | Don't open it |
| 5432 (TCP) | PostgreSQL | Don't open it |
| 6379 (TCP) | Redis | Don't open it |
| 3000, 8000, etc. | Apps you've built | Usually not opened; put them behind Nginx |
A Discord bot isn't a program that accepts connections from outside, so you don't need to open any ports for it.
For why you shouldn't open DB ports, see Installing a database; for how to put an app behind Nginx, see Deploying your own web app to a server.
TCP and UDP
Even with the same port number, TCP and UDP have to be opened separately. Open whichever the program's documentation says. For example, a Bedrock server uses UDP, so opening 19132/tcp won't let anyone connect.
How to open a port
See Opening firewall ports. Here's an example for Linux (ufw):
sudo ufw allow 25565/tcp
sudo ufw allow 19132/udp
Check that the program has opened the port and is listening
If you still can't connect after opening the firewall, check from inside the server whether the program is really listening on that port.
sudo ss -tulpn
Find the port number in the Local Address column.
0.0.0.0:25565or*:25565— It can accept connections from outside.127.0.0.1:25565— It only accepts connections from inside the server. You need to change the listening address in the program's settings before anyone can connect from outside.- Not in the list — The program is off or using a different port.
Check from your PC whether a port is open (Windows)
Run this in PowerShell on your PC. (It can only check TCP ports.)
Test-NetConnection server-ip -Port 25565
If you see TcpTestSucceeded : True, the port can be reached from outside.