Firewalld manages network access rules through zones. On a Linux server already using it, you can inspect the active configuration and add a rule for a required service.
Check the current firewall
You need administrator access and a working server console before changing remote-access rules. Do not start firewalld alongside another firewall manager without an approved migration plan.
sudo systemctl status firewalld
sudo firewall-cmd --state
sudo firewall-cmd --get-active-zonesThe state command reports whether the daemon is running. Inspect the zone assigned to the relevant network interface. In the examples below, replace public with that actual zone.
sudo firewall-cmd --zone=public --list-all
sudo firewall-cmd --permanent --zone=public --list-allAdd a required port
For example, allow HTTP on port 80 in the current runtime configuration:
sudo firewall-cmd --zone=public --add-port=80/tcpAfter testing the intended access, add the same rule to the permanent configuration:
sudo firewall-cmd --permanent --zone=public --add-port=80/tcpThis opens the port for the zone’s applicable traffic. Restrict sources through an appropriate policy if the service should not be publicly reachable.
Understand runtime and permanent changes
Runtime changes take effect immediately but normally disappear at reload or restart. Permanent changes are saved for later activation. Adding the same rule to both configurations, as above, avoids needing a reload just to activate that rule.
A standard reload replaces runtime configuration with permanent configuration:
sudo firewall-cmd --reloadReview the permanent rules before reloading, especially those preserving SSH access. Unsaved runtime changes can be lost. Do not use --complete-reload as a routine apply step; it can disrupt active connections.
Troubleshoot a rule
Check the active zone, listening service, source restrictions and any provider firewall. Review logs with sudo journalctl -u firewalld. Starting the daemon or changing debug options is a separate administration task and should not be used as a blind fix for a blocked port.