How to Enable, Disable and Restart firewalld

Firewalld is a dynamic firewall manager and a frontend for the Linux kernel’s NetFilter packet filtering framework.

Yes, it gives you so much control over the firewall management but the question is how you enable, disable, and restart firewalld?

Let me help.

How to enable firewalld

Enabling a service in Linux means it will start automatically when the system boots which is crucial for services like web servers, firewalls, etc.

To enable firewalld, all you have to do is use the enable flag with the systemctl command as shown here:

sudo systemctl enable firewalld

Once done, you can confirm if the service is enabled on the system boot using the following command:

systemctl is-enabled firewalld
check if firewalld is enabled or not

How to start firewalld

The thing is enabling firewalld does not start the firewalld in your current session. It will only work if you reboot your system and that’s not the ideal way to start a service.

To start firewalld, use the start flag with the systemctl command as shown here:

sudo systemctl start firewalld

Once done, you can check the status of the firewalld to verify if the service is running as intended or not:

systemctl status firewalld 
Check the status of the firewalld

How to disable firewalld

Disabling firewalld means the firewalld service will not start automatically when your system boots.

To disable firewalld, all you have to do is use the disable flag as shown here:

sudo systemctl disable firewalld
disable firewalld

You can check if it is disabled successfully or not by checking the status of the service:

systemctl status firewalld
Check status of firewalld

As you can see, the firewalld is still actively running. Why? Because disabling firewalld will take effect from the next boot.

If you want to stop it immediately, use the following:

sudo systemctl stop firewalld

Once done, you can check the status again and the output will indicate that the service is no longer active:

Check status of firewalld afer disabling it

Wrapping Up…

This was a quick tutorial on how you can enable, start, and disable firewalld including how you can stop it after disabling the service to take immediate effect.

I hope you will find this guide helpful and if you have any queries, feel free to leave us a comment.