Skip to content

Instantly share code, notes, and snippets.

@mb00g
Last active August 13, 2024 03:42
Show Gist options
  • Save mb00g/d78322d939a308e2f577565074dca3b8 to your computer and use it in GitHub Desktop.
Save mb00g/d78322d939a308e2f577565074dca3b8 to your computer and use it in GitHub Desktop.

Managing firewalld

firewall-cmd --state     # Display whether service is running
firewall-cmd --reload    # To reload the permanent rules without interrupting existing persistent connections

list details of default and active zones

firewall-cmd --get-default-zone
firewall-cmd --get-active-zones
firewall-cmd --list-all

add/remove interfaces to zones

To add interface “eth1” to “public” zone.

firewall-cmd --zone=public --change-interface=eth1

list/add/remove services to zones

To add “samba and samba-client” service to a specific zone. You may include, “permanent” flag to make this permanent change.

firewall-cmd --zone=public --add-service=samba --add-service=samba-client --permanent

list and Add ports to firewall

firewall-cmd --list-ports
firewall-cmd --zone=public --add-port=5000/tcp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment