Firewalld Cheat Sheet

firewalld is a modern firewall framework utilizing nftables

Zones

sudo firewall-cmd --list-all-zones
sudo firewall-cmd --get-active-zones
sudo firewall-cmd --zone=ZONE --change-interface=INTERFACE
sudo firewall-cmd --get-default-zone
sudo firewall-cmd --set-default-zone=ZONE
sudo firewall-cmd --zone=ZONE --list-all

Services

sudo firewall-cmd --zone=ZONE --get-services
sudo firewall-cmd --zone=ZONE --add-service SERVICE
sudo firewall-cmd --zone=ZONE --remove-service SERVICE

Ports

sudo firewall-cmd --zone=ZONE --add-port PORT/PROTO
sudo firewall-cmd --zone=ZONE --remove-port PORT/PROTO

Saving to Permanent

sudo firewall-cmd --runtime-to-permanent