Package / system tool

firewall-cmd — RHEL family

firewall-cmd is used for package management or system administration in the RHEL family. Consult the distribution manual for release-specific behaviour.

Availability: RHEL, Fedora, Rocky Linux and related distributions; exact package manager depends on release.中文

Syntax

firewall-cmd [options]

Examples

firewall-cmd is used for package management or system administration in the RHEL family. Consult the distribution manual for release-specific behaviour.

sudo firewall-cmd --list-all

Show command help and options where supported.

firewall-cmd --help

Parameters, options and clauses

Option / clauseDescription
--state / --list-allCheck firewalld state and show the selected zone configuration.
--zone=<zone>Select a firewall zone.
--add-port=<port>/<protocol>Add a port rule to runtime or permanent configuration.
--permanentWrite changes to permanent configuration; reload to activate them.
--reloadReload permanent configuration into runtime state.
Safety note

Review a command and its target before running it. Commands that alter files, services, accounts, disks, permissions or databases may be difficult to reverse. Test in a safe environment and keep backups.

Official reference ↗Back to directory