How to release game ports in UFW
Game servers need to receive connections on specific ports. In Ubuntu, UFW allows you to open only what is necessary without disabling the VPS Gamer's entire firewall.
Before activating the firewall
Allow SSH access:
sudo ufw allow OpenSSH
Keep the current session open and test a second SSH connection after enabling UFW.
1. Check the status
sudo ufw status verbose
If Status: inactive appears, the firewall is deactivated.
2. Activate UFW
sudo ufw enable
Confirm with y when prompted.
3. Free up a TCP port
Example for Minecraft Java on port 25565:
sudo ufw allow 25565/tcp
4. Free up a UDP port
When the game requires UDP:
sudo ufw allow 27015/udp
Port 27015 is used by several Steam-based servers, but each game has its own requirements.
5. Release TCP and UDP
For an application that uses both protocols:
sudo ufw allow 30120/tcp
sudo ufw allow 30120/udp
Check in the game documentation if both are really necessary.
6. Free up a break
sudo ufw allow 27015:27020/udp
Intervals increase the exposed surface. Prefer specific ports when possible.
7. Restrict by IP address
To allow an administrative port only from a trusted IP:
sudo ufw allow from SEU_IP to any port 8080 proto tcp
Replace YOUR_IP with your authorized public address.
8. List the numbered rules
sudo ufw status numbered
The output shows the protocol, origin, and a number for each rule.
9. Delete a rule
By number:
sudo ufw delete NUMERO_DA_REGRA
Or repeating the rule:
sudo ufw delete allow 25565/tcp
List again because the numbering changes after each deletion.
How to find out if the game is listening
sudo ss -lntup
A rule in the firewall does not start the server. The game process needs to be active and listening on the same port and protocol.
Common problems
The door is released, but appears closed
Check that the server is running, that it listens on the correct address, and that there is another firewall or network rule.
Can I use ufw disable to test?
This temporarily removes protection from all ports. Prefer reviewing the specific rule and logs.
Do I need to open all Steam ports?
No. Only release the ports required by the dedicated server and features you have enabled.
Related tutorials
- How to install SteamCMD on Linux VPS
- How to create Minecraft server on VPS Ubuntu
- Complete Guide to UFW on Linux VPS
If you need help with VPS Gamer, open a ticket with Nice Hosting support.