Open a Port in firewalld with firewall-cmd
Permanently allow a TCP or UDP port through firewalld on Fedora, RHEL, or CentOS so your web app or game server is reachable.
Run sudo firewall-cmd --permanent --add-port=8080/tcp followed by sudo firewall-cmd --reload to open a port permanently.
01Command
Command
$ sudo firewall-cmd --permanent --add-port=8080/tcp && sudo firewall-cmd --reload02What it does
firewalld groups rules into zones; commands without --permanent apply only until the next reload or reboot, so the permanent flag plus reload is what makes an open port stick. Use /tcp or /udp to pick the protocol, and --list-ports (add --permanent to see saved rules) to verify. Where a well-known service exists, prefer --add-service=http, which is easier to read than a bare port number.
03Risk
!Warning: Opening a port exposes that service to the network it faces — only open what the service actually listens on, and close it again with --remove-port when you no longer need it.
04Undo
Undo
$ sudo firewall-cmd --permanent --remove-port=8080/tcp && sudo firewall-cmd --reload05Sources
- firewall-cmd(1) — Ubuntu manual pageEvidence: Reference for firewall-cmd port options and runtime vs permanent configuration behavior.
- firewall-cmd(1) — official man pageEvidence: Documents --add-port, --permanent, and --reload for opening ports in firewalld zones.
Last verified: 2026-09-18 · Category: Network