Docs / Networking / How to Set Up a Firewall with firewalld

How to Set Up a Firewall with firewalld

By Admin · Feb 25, 2026 · Updated Apr 23, 2026 · 292 views · 1 min read

Firewalld is the default firewall on RHEL-based distributions (AlmaLinux, Rocky Linux, CentOS).

Start and Enable

systemctl start firewalld
systemctl enable firewalld

Common Commands

# Allow a service
firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https
firewall-cmd --permanent --add-service=ssh

# Allow a port
firewall-cmd --permanent --add-port=3000/tcp

# Remove a rule
firewall-cmd --permanent --remove-port=3000/tcp

# Reload rules
firewall-cmd --reload

# List rules
firewall-cmd --list-all

Zones

Firewalld uses zones to define trust levels. The default zone is public. You can check it with:

firewall-cmd --get-active-zones

Was this article helpful?