Main Menu

Search

LINUX: Useful Firewall Commands Cheatsheet (firewall-cmd)

firewall-cmd Command To Add Multiple Ports 

firewall-cmd --permanent --add-port={<port>/<protocol>,<port>/<protocol>,......,<port>/<protocol>}

For e.g.

firewall-cmd --permanent --add-port={10257/tcp,10259/tcp,2381/tcp,10249/tcp,9100/tcp}

firewall-cmd Command to Reload Firewall settings on the fly after applying

firewall-cmd --reload

firewall-cmd Command To List all the Zones

firewall-cmd --list-all-zones

firewall-cmd Command To List Settings of Specific Zone

firewall-cmd --zone=<zone name> --list-all

For e.g. to list settings of public zone, command will be as follows

firewall-cmd --zone=public --list-all

firewall-cmd command to get list of zones

firewall-cmd --get-zones

firewall-cmd command to get the default zone

firewall-cmd --get-default-zone

firewall-cmd command to set the default zone

firewall-cmd --set-default-zone zone-name

firewall-cmd command to list active zones and interfaces assigned to them.

firewall-cmd --get-active-zones

firewall-cmd command to create new zone

firewall-cmd --permanent --new-zone=<zone-name>

firewall-cmd command to save the runtime changes made permanent

firewall-cmd --runtime-to-permanent

No comments:

Post a Comment