Overview
firewalld is the default firewall management tool on Rocky Linux, AlmaLinux, Fedora and other RHEL-family distributions. It uses zones to group rules and supports runtime changes that you can persist. This article shows how to open the ports your services need while keeping the Pod protected.
Before you begin
- A Rocky, AlmaLinux or Fedora Pod with sudo access.
firewalldinstalled (usually present by default).
Steps
- Ensure the service is running and enabled at boot:
bash
sudo systemctl enable --now firewalld
sudo firewall-cmd --state
- Check which zone is active on your main interface:
bash
sudo firewall-cmd --get-active-zones
sudo firewall-cmd --get-default-zone
- Open the ports you need. Use
--permanentfor persistent rules, then reload:
bash
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --permanent --add-port=8080/tcp
sudo firewall-cmd --reload
- Confirm what is allowed:
bash
sudo firewall-cmd --list-all
- Restrict a rule to a source network when appropriate:
bash
sudo firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="203.0.113.0/24" port port="3306" protocol="tcp" accept'
sudo firewall-cmd --reload
- Remove a rule you no longer need:
bash
sudo firewall-cmd --permanent --remove-service=http
sudo firewall-cmd --reload
Runtime versus permanent
Changes without --permanent apply immediately but are lost on reload or reboot. Changes with --permanent only take effect after --reload. When in doubt, add both runtime and permanent, then reload.
Troubleshooting
- Problem: SSH stops working after a change. Solution: The
sshservice is normally allowed in the default zone; re-open it withsudo firewall-cmd --permanent --add-service=ssh && sudo firewall-cmd --reload, using Console access if needed. - Problem: A port is open locally but unreachable from outside. Solution: Also allow the port in the ALYPOD cloud firewall in the Console.
Related articles
- [Configuring a firewall with ufw]
- [Troubleshooting network connectivity]
