Bilgi Bankası

Configuring a firewall with firewalld Yazdır

  • firewalld, firewall, rocky, almalinux, security
  • 0

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.
  • firewalld installed (usually present by default).

Steps

  1. Ensure the service is running and enabled at boot:

bash sudo systemctl enable --now firewalld sudo firewall-cmd --state

  1. Check which zone is active on your main interface:

bash sudo firewall-cmd --get-active-zones sudo firewall-cmd --get-default-zone

  1. Open the ports you need. Use --permanent for 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

  1. Confirm what is allowed:

bash sudo firewall-cmd --list-all

  1. 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

  1. 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 ssh service is normally allowed in the default zone; re-open it with sudo 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]

Bu cevap yeterince yardımcı oldu mu?

<< Geri