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.

LinuxportsfirewalldfirewallMedium risk
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 --reload

02What 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

RiskMedium risk
Requirementsfirewalld (default on RHEL, Fedora, CentOS, openSUSE)
!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 --reload

05Sources

Last verified: 2026-09-18 · Category: Network