Firewall state without accidental changes
Audit zones, services, ports, runtime, and permanent rules before editing.
firewall-cmd --list-all
20 min read, 30 min lab
operator
Firewalld uses zones attached to interfaces and sources. Runtime changes can disappear after reboot unless made permanent. Audit first; change only with a rollback plan.
Port 8443 should be reachable, but nobody knows whether the host firewall permits it.
Worked command
$ firewall-cmd --get-active-zones$ firewall-cmd --zone=public --list-all$ firewall-cmd --runtime-to-permanent$ firewall-cmd --reload
Do not add ports to the default zone without checking which zone owns the interface.
List active zones and current rules before proposing any change.
You ran `firewall-cmd --add-port=8443/tcp` and the port opened. Why might 8443 be closed again after a reboot?
Show the answer
Correct: A. The change was runtime-only; without --permanent (or --runtime-to-permanent) it is lost on reboot
Runtime rules live only in the running config and vanish on reboot unless written to the permanent config. The trap is --reload: it re-applies the permanent config, so without making the rule permanent first, reload actually drops the runtime-only change rather than persisting it.
Practice checklist
- Use a VM or sample output.
- Identify active zones and services.
- Write a proposed change without applying it.
Deliverable evidence
- Firewall audit note with zone, services, ports, and runtime/permanent status.
shows: The diagnostic ladder for a reachability symptom: address and route, then DNS name resolution, then listening socket, then HTTP response, with firewall audited separately, and each command proving only its own layer.
does not prove: It does not prove the failure is single-layer: more than one layer can be broken at once, and a green check at one step is evidence for that step only, not proof the whole path works.
Commit these to memory, then drill them until recall is automatic.
cue You added firewall ports at runtime and want them to survive a reboot without re-typing each rule
show recall target
firewall-cmd --runtime-to-permanent