Skip to content
Search Oracle Linux

    Browse this documentation

    firewalld in practice: the runtime vs permanent two-layer model measured (an 8443 case)

    firewalld’s single core difficulty: the two layers of runtime (running) and permanent (persistent). This page nails both layers with a complete 8443 measurement; everything else is combinations.

    Terminal window
    firewall-cmd --state # running
    firewall-cmd --get-active-zones
    firewall-cmd --list-all
    public (default, active)
    interfaces: ens18
    services: cockpit dhcpv6-client ssh

    OL 10 defaults: a single public zone allowing cockpit (9090), dhcpv6-client and ssh. Traffic from interfaces without their own binding enters the default zone.

    The two-layer model: the 8443 case measured

    Section titled “The two-layer model: the 8443 case measured”
    Terminal window
    # 1. Write only the persistent layer
    firewall-cmd --permanent --add-port=8443/tcp
    # success
    # 2. Query the runtime — not there!
    firewall-cmd --query-port=8443/tcp
    # no ← permanent changes do not enter runtime
    # 3. Reload pours the persistent layer into the runtime
    firewall-cmd --reload
    firewall-cmd --query-port=8443/tcp
    # yes ← effective now
    # 4. Cleanup (remove from both layers)
    firewall-cmd --permanent --remove-port=8443/tcp && firewall-cmd --reload

    The measured comparison:

    ActionImmediateSurvives reboot
    --add-* (without —permanent)✅❌
    --permanent --add-*❌ (needs reload)✅
    --permanent --add-* + --reload✅✅
    runtime change + --runtime-to-permanent✅✅

    Workflow suggestion: experiment in runtime, then persist once with firewall-cmd --runtime-to-permanent once verified — handier than pairing —permanent + reload every time.

    Terminal window
    # Service sets (predefined, e.g. http/https/ssh)
    firewall-cmd --add-service=http --permanent
    firewall-cmd --remove-service=http --permanent
    # Ports (when no predefined service exists)
    firewall-cmd --add-port=8443/tcp --permanent
    # Rich rule (fine-grained rules with a source qualifier)
    firewall-cmd --permanent --add-rich-rule='rule family=ipv4 source address=192.168.50.0/24 port port=5432 protocol=tcp accept'
    # Troubleshooting: the current state of a port
    firewall-cmd --query-port=8443/tcp
    firewall-cmd --list-ports --permanent

    The troubleshooting order for an unreachable port: ss confirms listening → firewalld confirms allowance → SELinux confirms permission (semanage port -l | grep <port>; a service binding a non-default port gets stopped by SELinux too — see the SELinux page). Each of the three layers owns one segment; do not guess across them.