Updated: 22 October 2026 · Applies to: AlmaLinux 9 / Rocky Linux 9 (and Ubuntu 24.04 / Debian 12 with UFW)
CentOS 8 is end of life; the same commands work on AlmaLinux 9 / Rocky Linux 9.
- Open the port (use
/udpfor UDP):firewall-cmd --permanent --add-port=8080/tcp - Or a range:
firewall-cmd --permanent --add-port=10000-10100/udp - Or a known service:
firewall-cmd --permanent --add-service=http - Apply it:
firewall-cmd --reload - Check it:
firewall-cmd --list-portsandfirewall-cmd --list-services.
To close the port again, use --remove-port or --remove-service and reload.
Ubuntu and Debian: UFW
apt install ufw ufw allow OpenSSH # always allow SSH before enabling ufw allow 80,443/tcp ufw enable ufw status numbered ufw delete 3 # remove rule number 3
Tip: On a Ucartz VPS, keep the VNC console open (client area › your VPS service › VPS dashboard) while you change firewall or network settings. If you lock yourself out of SSH, you can still fix it from the console.
Check that it works
- The service must listen on the port:
ss -tlnp | grep 8080. - The rule must be in the active zone:
firewall-cmd --get-active-zonesshows which zone your interface uses; add--zone=<name>to the commands if it is not the default zone. - Test from another computer:
nc -zv SERVER-IP 8080.