LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

firewall-cmd

dynamic firewall management interface

TLDR

Check firewalld daemon status
$ firewall-cmd --state
copy
List all active zones with their interfaces
$ firewall-cmd --get-active-zones
copy
List all rules in the default zone
$ firewall-cmd --list-all
copy
Add a service permanently to a zone
$ firewall-cmd --permanent --zone public --add-service https
copy
Add a port permanently to a zone
$ firewall-cmd --permanent --zone public --add-port 8080/tcp
copy
Remove a service permanently
$ firewall-cmd --permanent --zone public --remove-service http
copy
Reload configuration (apply permanent changes at runtime)
$ firewall-cmd --reload
copy
Save runtime config to permanent
$ firewall-cmd --runtime-to-permanent
copy
Enable masquerade (NAT) on a zone
$ firewall-cmd --permanent --zone public --add-masquerade
copy

SYNOPSIS

firewall-cmd [OPTIONS]

DESCRIPTION

firewall-cmd is the command-line interface for firewalld, providing dynamic management of the Linux firewall. It supports zones, services, port forwarding, masquerading, and rich rules with both runtime and permanent configurations.

PARAMETERS

--state

Check whether the firewalld daemon is active (returns exit code 0 if running).
--reload
Reload firewall rules while keeping state information. Applies permanent rules to the runtime configuration.
--complete-reload
Reload the firewall completely, including netfilter kernel modules. May terminate active connections.
--runtime-to-permanent
Save the current runtime configuration to permanent.
--get-zones
List all predefined zones.
--get-default-zone
Print the default zone for connections and interfaces.
--set-default-zone zone
Set the default zone.
--get-active-zones
Print currently active zones with their bound interfaces and sources.
--list-all-zones
List all available zones with their complete settings.
--list-all
List everything added or enabled in the current or specified zone.
--zone zone
Specify the zone to operate on.
--get-services
List all predefined services.
--add-service service
Add a service to the zone.
--remove-service service
Remove a service from the zone.
--add-port port/protocol
Add a port (or port range) to the zone (e.g. `8080/tcp` or `5000-5100/tcp`).
--remove-port port/protocol
Remove a previously added port from the zone.
--add-masquerade
Enable IPv4 masquerade (NAT) on the zone. Useful when the machine is a router.
--remove-masquerade
Disable IPv4 masquerade on the zone.
--query-masquerade
Return whether IPv4 masquerade is enabled in the zone.
--add-rich-rule rule
Add a rich language firewall rule.
--remove-rich-rule rule
Remove a rich language firewall rule.
--permanent
Make changes permanent (survives reboot). Requires `--reload` to take effect at runtime.
--panic-on / --panic-off
Enable/disable panic mode (drops all incoming and outgoing traffic).
--change-interface interface
Change the zone binding of a network interface.

CONFIGURATION

**/etc/firewalld/zones/*.xml**

Zone definitions including allowed services, ports, and rich rules.
**/etc/firewalld/services/*.xml**
Service definitions mapping service names to ports and protocols.

INSTALL

sudo dnf install firewalld
copy
sudo pacman -S firewalld
copy
sudo apk add firewalld
copy
sudo zypper install firewalld
copy
nix profile install nixpkgs#firewalld
copy

CAVEATS

Changes without --permanent are lost on reload or reboot. After permanent changes, use --reload to apply them. Zone changes may disconnect active sessions.

HISTORY

firewall-cmd is the client for firewalld, Red Hat's dynamic firewall management daemon used in RHEL, CentOS, and Fedora.

SEE ALSO

firewalld(1), iptables(8), nft(8)

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid