Stop and Disable Firewalld on CentOS 7 - Step by Step Process ?

FirewallD is a firewall management tool which is available on CentOS 7 servers by default. You can manage and configure network connections which traffic is allowed or disallowed to and from the system.

With the release of CentOS 7, FirewallD taken place of iptables as the default firewall management tool. For the security purpose it is recommended to keep enabled Firewalld service.

Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform related firewall queries.

In this context, we shall look into how to stop and disable Firewalld on CentOS 7 system.

How to Check FirewallD Status ?

Before proceeding with this configuration procedure, ensure that you are using a user account with sudo privileges.

If you have not yet set up FirewallD or having any troubles in configuring it you can check this guide How to setup a firewall with firewalld on CentOS 7.

You can view the current status of the Firewalld service by using the firewall-cmd command:

$ sudo firewall-cmd --state

You will get output as below and if FirewallD service is running on your CentOS system then it will print running message:


How to Stop FirewallD ?

If you want to stop firewall service temporarily, you can do it by running below command:

$ sudo systemctl stop firewalld

This change will be valid for the current runtime session only.


How to Disable FirewallD ?

Once you will disable the firewall it will stop permanently. To disable the firewall on your CentOS 7 system follow below steps:

i. First, you need to stop FirewallD service by issuing below command:

$ sudo systemctl stop firewalld

ii. Now you can disable FirewallD by typing:

$ sudo systemctl disable firewalld

This will disable Firewalld permanently but there are chances that it can be started by other service. 

iii. To prevent firewall frombeing started by other services you need to Mask FirewallD by run below command:

$ sudo systemctl mask --now firewalld

It will print message like below:

Created symlink from /etc/systemd/system/firewalld.service to /dev/null.

How to Manage FirewallD Services ?

If you have disabled FirewallD services and want to start it again then following command will be helpful.

i. To unmask your FirewallD service on your system execute command:

$ sudo systemctl unmask --now firewalld

It will show output as below:

Removed symlink /etc/systemd/system/firewalld.service.

ii. You can enable FirewallD running following command:

$ sudo systemctl enable firewalld

Output will be as following:

Created symlink from /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service to /usr/lib/systemd/system/firewalld.service.
Created symlink from /etc/systemd/system/ to /usr/lib/systemd/system/firewalld.service.

iii. After enabling FirewallD service you have need to start it by run below command:

$ sudo systemctl start firewalld

[Need to fix Linux System Security ? We can help you. ]

This article covers how to stop and disable FirewallD on your CentOS 7 system. Firewalld is a complete firewall solution that has been made available by default on all CentOS 7 servers. It is highly recommended that you have another firewall protecting your network or server before, or immediately after, disabling firewalld.

How to manage Firewalld ?

1. To disable firewalld, run the following command as root:

$ systemctl disable firewalld

2. To Stop Firewalld, execute the following command as root:

$ systemctl stop firewalld

3. To check the status of firewalld, run the following command as root:

$ systemctl status firewalld

Related Posts