How-to

Stop or Disable firewalld on CentOS Stream, Rocky and Alma

firewalld is a systemd service, so systemctl stops it for now and disables it for future boots. Before switching it off, decide what will guard the machine in its place.

Is firewalld running on my machine?

On the Enterprise Linux images we install (CentOS Stream 9, Rocky Linux 9 and AlmaLinux 9), firewalld is the standard firewall manager. Check its state with either command:

systemctl is-active firewalld
firewall-cmd --state

active or running means it is filtering traffic right now. firewall-cmd --list-all then shows the active zone, the services and ports it allows and the interfaces bound to it. Read that list before you change anything: often the real goal is opening one port, which needs no shutdown at all.

Do I really need to disable it?

Usually not. Most "the firewall is blocking my app" problems are fixed in one line:

firewall-cmd --permanent --add-port=8443/tcp
firewall-cmd --permanent --add-service=postgresql --zone=public
firewall-cmd --reload

--permanent writes to the saved configuration and --reload applies it, so the change survives reboots. Good reasons to turn firewalld off completely are different: you are moving to hand-written nftables or iptables rules, a control panel or orchestrator wants to own the rules, or you are debugging and need to rule the firewall out for a few minutes.

How do I stop firewalld temporarily?

systemctl stop firewalld

This removes its rules until the next start or reboot. Anything listening on any port is now reachable from the internet, so keep the window short. When you are done testing, run systemctl start firewalld to bring the saved configuration back.

How do I disable it permanently?

systemctl disable --now firewalld
systemctl is-enabled firewalld

disable --now stops the service and removes it from boot in one command. The second line should print disabled. To stop other packages or scripts from starting it again by accident, mask it:

systemctl mask firewalld

A masked unit links to /dev/null and cannot be started until you run systemctl unmask firewalld. If you do not need firewalld at all, dnf remove firewalld is also fine; reinstall it later with dnf install firewalld.

What should protect the box instead?

A public server with no packet filter is reachable on every listening port. Our edge DDoS filtering handles floods, not access control, so put a replacement in place in the same session:

OptionInstallGood when
nftablesdnf install nftables, rules in /etc/sysconfig/nftables.confYou want one clean, hand-written rule file
iptables-servicesdnf install iptables-services, rules in /etc/sysconfig/iptablesYou reuse existing iptables scripts
Bind services to localhostPer service configDatabases and admin tools that only local apps use

A short nftables file that allows SSH and web traffic looks like this:

table inet hostfw {
  chain in {
    type filter hook input priority filter; policy drop; # anything not matched below is discarded
    iif lo accept
    ct state vmap { established : accept, related : accept, invalid : drop }
    meta l4proto icmp accept
    tcp dport { 22, 80, 443 } ct state new accept
  }
}

Load it with nft -f /etc/sysconfig/nftables.conf, confirm a second SSH session works, then run systemctl enable --now nftables. The iptables route is described in iptables basics.

Why are my rules gone after a firewalld reload?

firewalld owns its tables. Any rule you added with iptables or nft while firewalld runs can be wiped by firewall-cmd --reload or a service restart. Pick one manager. If you keep firewalld, add custom rules through it with rich rules or --direct style policies; if you leave it, disable it first, then load your own rules.

Does Docker or Proxmox change this?

Docker writes its own NAT and filter rules and coexists with firewalld through a dedicated docker zone on recent releases. If you disable firewalld on a Docker host, restart Docker afterward so it rebuilds its chains. Proxmox VE runs on Debian, not on this family, and has its own firewall layer, so none of these commands apply there; see Proxmox VE.

What about SELinux, is that also the firewall?

No. SELinux controls what processes may do on the machine, not which packets arrive. A service that refuses connections with firewalld stopped may be blocked by SELinux port labels instead: semanage port -a -t http_port_t -p tcp 8443 lets a web server bind a new port. Check ausearch -m avc -ts recent for denials before you think about switching SELinux to permissive.

The CentOS Stream 9, Rocky Linux 9 and AlmaLinux 9 images can be chosen on any of the 68 machines, for example S2 or D2; details are on CentOS Stream, Rocky Linux and AlmaLinux.

Machines Commonly Run on Enterprise Linux

ServerProcessorCores / threadsMemoryStorageNetworkPer monthSmallest order
S2Intel Xeon E-2356G6 / 1264 GB DDR41x 1 TB NVMe2x 10 Gbps$58.39$58.39 (1 month)
S4Intel Xeon E-2388G8 / 1664 GB DDR41x 1 TB NVMe2x 10 Gbps$87.52$87.52 (1 month)
D22x Intel Xeon Gold 531724 / 48128 GB DDR42x 1 TB NVMe2x 25 Gbps$223.57$223.57 (1 month)
D42x Intel Xeon Gold 632632 / 64128 GB DDR42x 1 TB NVMe2x 25 Gbps$275.41$275.41 (1 month)

Keep Reading

iptables basics

How iptables tables, chains and targets fit together, plus a minimal default-deny rule set for a new bare metal server.

Open

Rocky Linux

Rocky Linux 9, a free Red Hat compatible rebuild focused on staying bug for bug identical to its upstream.

Open

CentOS Stream

CentOS Stream 9 lets you test the next Red Hat minor release early, on a full machine of your own.

Open

Set up fail2ban

Install fail2ban, write a jail.local for SSH and nginx, read the ban list and unban an address you locked out by mistake.

Open

FAQ

Quick Answers

No. stop only lasts until the next boot. disable keeps it from starting at boot, and disable --now does both at once.

Run systemctl unmask firewalld if you masked it, then systemctl enable --now firewalld.

Only with another packet filter in place, such as nftables or iptables-services, or with every service bound to localhost.

The service is stopped or masked. Start it with systemctl start firewalld, or unmask it first.

Yes. CentOS Stream 9, Rocky Linux 9 and AlmaLinux 9 share the same firewalld and systemd setup.

No. Edge filtering runs in the network before traffic reaches your port and is independent of the host firewall.