Blog Post
How to Quickly Stop or Permanently Disable FirewallD on CentOS 7

How to Quickly Stop or Permanently Disable FirewallD on CentOS 7

FirewallD is an excellent firewall management solution available on various distributions of Linux, including CentOS 7. FirewallD comes installed by default with the latest version of the operating system and is a great utility for managing trust levels for both network connections and interfaces. The utility is very easy to use once you get the hang of it. Among other things, the service lets you decide which traffic is allowed to and from your computer and which isn’t.

Although FirewallD comes pre-installed on CentOS 7, it isn’t automatically enabled, so you’ll need to do it yourself. Once you do enable it, you’ll generally want to leave it on in order to make the most out of it. However, there might be situations when you’ll want to temporarily disable or stop the utility. This shouldn’t happen too often under normal circumstances. But when it does, knowing how to quickly stop or disable the firewall will definitely come in handy.


FirewallD can only be stopped or disabled by a user who has sudo privileges. Make sure to check the privileges for the user you are currently logged into before attempting this. It’s also worth noting that if you have never enabled the firewall in the first place, you don’t need to worry about disabling it. As mentioned, FirewallD is not enabled by default on CentOS 7.

How to Check the Status of FirewallD

If you’re not sure about the current status of your firewall, there is a simple command that you can use to quickly find out. Simply open the terminal and type in the following:

sudo firewall-cmd --state

Provided FirewallD is currently running on your system, the terminal will output a message that simply reads ‘running’.

How to Temporarily Stop FirewallD

Stopping the firewall can be achieving by typing in the following command in the terminal:

sudo systemctl stop firewalld

It’s worth noting that this command only affects the current runtime. In other words, the firewall will only be stopped temporarily. Once you reboot your system, FirewallD will once again become enabled and revert to its previous settings.

How to Permanently Disable FirewallD

Temporarily stopping the firewall can be useful but sometimes you might want to permanently disable it instead. In that case, you’ll need to use a sequence of commands to achieve that goal, starting with the one we just mentioned. So once again, stop the firewall by typing in:

sudo systemctl stop firewalld

Next, you’ll want to make sure FirewallD remains disabled even after you reboot your system. You can make sure that happens by using the following command in the terminal:

sudo systemctl disable firewalld

Once you’ve used the second command, FirewallD will no longer start upon reboot. However, the firewall can still be enabled by certain other services. You can prevent this by using the command below to mask the utility from all other services. In other words, the firewall will be completely disabled after using the third command and can only be enabled again if you choose to do it manually.

sudo systemctl mask ---now firewalld

How to Start and Enable FirewallD

Once you want FirewallD to become enabled again you’ll need to go through the aforementioned sequence of commands again. This time, though, you’ll need to use them in reverse order. First, start by typing in:

sudo systemctl mask ---now firewalld

The firewall is now unmasked again so proceed by typing in the command below to enable the service:

sudo systemctl enable firewalld

Once FirewallD has been enabled again, you can start the service by typing:

sudo systemctl start firewalld

Finally, you can use the command below once again to check the status of FirewallD and make sure the service is running properly.

sudo firewall-cmd --state

Final Thoughts

The handful of commands we covered in this short guide will let you quickly disable FirewallD on CentOS 7 with no hassles. Once you need the utility to be up and running again, make sure to enable so you can enjoy the protection it offers. After all, FirewallD’s purposes is to safeguard your system against threats so it’s a good idea to always leave it on.

Related posts

Leave a Reply

Required fields are marked *

Copyright © 2022 All rights reserved.