How to Stop and Disable FirewallD on CentOS 7

How to Stop and Disable Firewalld on CentOS 7
How to Stop and Disable Firewalld on CentOS 7

Stop and Disable FirewallD on CentOS 7

Firewalld dynamically manages the trust level of network connections and comes as a complete firewall solution. Firewalld service mainly used to configure and manage network connections by deciding which packets to allow and block. There are two types of FirewallD configurations which are Permanent and Runtime. Permanent configuration always retained across the system boot so it is running all the time but on service restart runtime configuration will get lost. In this tutorial, you are going to learn how to stop and disable Firewalld on CentOS 7.

Prerequisites

Before you start to learn how to stop and disable FirewallD on CentOS 7. You must have the non-root user account on your system with sudo privileges.

Check Firewalld Status

First, you will need to check if FirewallD is running on your system or not. Check FirewallD status by running following firewall-cmd command.

sudo firewall-cmd --state

The output should look like:

Running

NOTE: If Firewalld service is running on your system you will get above output.

Stop FirewallD

To stop FirewallD temporarily run following command in the terminal:

sudo systemctl stop firewalld

The above command will only affect the current runtime session. On system boot, it will start again:

Disable FirewallD Permanently

To stop FirewallD permanently first, stop FirewallD service running on your system and then you should disable it.

Stop FirewallD service by running the following command:

sudo systemctl stop firewalld

Now Disable FirewallD using below command:

sudo systemctl disable firewalld

The above process will stop FirewallD service permanently but there are chances that it will be started by another service. To prevent this you should mask FirewallD service by running following commands.

To mask FirewallD to prevent it from started by another service run following command:

sudo systemctl mask --now firewalld

Starting and Enabling FirewallD

If you have disabled FirewallD then run following commands to start it again.

If FirewallD service is masked on your system then unmask it by running following command.

sudo systemctl mask --now firewalld

Now enable FirewallD running following command:

sudo systemctl enable firewalld

After enabling FirewallD run following command to start it:

sudo systemctl start firewalld

Conclusion

You have successfully learned how to stop and disable Firewalld on CentOS 7. If you have any queries regarding this then please don’t forget to comment below.