How to use Firewalld on Linux – A beginner’s guide

5/5 - (42 votes)

Firewalld is a firewall management tool used on Linux operating systems. Here’s a basic guide on how to use Firewalld:

  1. Check the Firewalld Status: First, you need to check the status of Firewalld using the following command:
sudo systemctl status firewalld
  1. Start and Enable Firewalld: If Firewalld is not running, start it using the following command:
sudo systemctl start firewalld

To ensure that Firewalld starts automatically on system boot, enable it using the following command:

sudo systemctl enable firewalld
  1. Check the Default Zone: Firewalld uses zones to control network access. You can check the default zone using the following command:
sudo firewall-cmd --get-default-zone
  1. List the Available Zones: To view the available zones, run the following command:
sudo firewall-cmd --get-zones
  1. Add Services to Zones: You can allow access to specific services by adding them to a zone. For example, to allow HTTP access, run the following command:
sudo firewall-cmd --zone=public --add-service=http --permanent

Note: The –permanent option makes the rule permanent across system reboots.

  1. Reload Firewalld: After adding or modifying rules, you need to reload Firewalld using the following command:
sudo firewall-cmd --reload
  1. Remove a Service from a Zone: If you need to remove a service from a zone, run the following command:
sudo firewall-cmd --zone=public --remove-service=http --permanent

Again, remember to reload Firewalld to apply the changes.

These are some basic steps to use Firewalld on Linux. Keep in mind that Firewalld offers a range of advanced features and commands that you can explore by referring to its documentation.

Charles F Flores

With over three years of in-depth experience working in technical fields, Charles is a master content writer who loves writing about Linux and Mac at Easy Tech Tutorials.

Leave a Comment