What is the usage of firewall-cmd in Linux?

firewall-cmd is a command-line tool in Linux used to manage the firewalld service. It can be used to configure firewall rules, view firewall status, and manage firewall services and zones.

Below are some common uses of firewall-cmd:

  1. Enabling and disabling the firewall:
  2. Enable the firewall: sudo firewall-cmd –state
  3. Disable the firewall: sudo systemctl stop firewalld
  4. – “Searching for and configuring firewall rules:”
  5. List all rules by running: sudo firewall-cmd –list-all
  6. Check the rules for a specific area: sudo firewall-cmd –zone= –list-all
  7. Include the rule by using the command: sudo firewall-cmd –zone= –add-
  8. Remove rule: sudo firewall-cmd –zone= –remove-
  9. Management services and regions:
  10. List all zones: sudo firewall-cmd –get-zones
  11. Check the services in a specific zone: sudo firewall-cmd –zone= –list-services
  12. Add a service to a zone: sudo firewall-cmd –zone= –add-service=
  13. Remove service from zone: sudo firewall-cmd –zone= –remove-service=
  14. Set up firewall policies.
  15. Set the default zone: sudo firewall-cmd –set-default-zone=
  16. Create a new zone by using the following command: sudo firewall-cmd –new-zone=
  17. Remove zone: sudo firewall-cmd –delete-zone=

The above are just some common uses of firewall-cmd, for more detailed usage you can check through the ‘man firewall-cmd’ command.

bannerAds