CentOS: Stop and Disable Firewall

This blog receives a commission from affiliate partners through the affiliate links that we share with you in our posts. Although we receive a commission for using and linking their products, all our opinions and suggestions are unbiased.

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:

Prerequisites

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.

Chad Crouch

Chad is an experienced Systems Administrator with exposure to various technologies and enterprise ICT environments. He has a huge passion for Technologies, specifically Linux, Open Source Software, Cloud Computing, DevOps, Software & Web Development, electronics, and IoT technologies. If you enjoy our articles please support us and make a small contribution: Buy Us A Coffee