CentOS: Stop and Disable Firewall

FirewallD is a complete firewall solution that comes pre-installed with CentOS Linux. It gives you full control of the allowed and disallowed traffic to and from your system. I highly recommend to always keep FirewallD active on your system but for testing purposes, you sometimes want to disable it. In this tutorial I am going to show you step by step how to disable FirewallD:


Before you start the process to disable firewalld, ensure that you are logged in as a user with root privileges.

Check Firewall Status

You can use the firewall-cmd command to view the current status of firewallD.

sudo firewall-cmd --state

If it is running it will display that it is active(running)

Disable Firewall

Temporarily stop firewall with the following command:

sudo systemctl stop firewalld

Please note that this change is only valid for the current session.

To permanently disable firewall follow the following steps:

Stop firewall:

sudo systemctl stop firewalld

Disable firewallD service so that it does not start up automatically when your system boots up:

sudo systemctl disable firewalld

The output would look similar to the terminal window below:

Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.

Mask firewalld to ensure that it won’t be started by other services:

sudo sysemctl mask --now firewalld

Your output will look like this:

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

Once you completed all those steps then you completely disabled the firewall on CentOS 7.

Feel free to leave a comment below if this tutorial was useful or if you would like to add something.

Liked it? Take a second to support Chad Crouch on Patreon!

Chad Crouch

Chad is a Software/DevOps Engineer with exposure and experience in various technologies and enterprise ICT environments. He has a huge passion for Technologies, specifically Linux and Open Source Software. If you enjoy our articles please support us and make a small contribution: Buy Us A Coffee