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
If the FirewallD service is running on your CentOS system the command above will print the following message:
running
How to 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 permanently disable the firewall on your CentOS 8 system, follow the steps below:
1. First, stop the FirewallD service with:
$ sudo systemctl stop firewalld
2. Disable the FirewallD service to start automatically on system boot:
$ sudo systemctl disable firewalld
The output from the command above will look something like this:
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service. Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
3. Mask the FirewallD service which will prevent the firewall from being started by other services:
$ sudo systemctl mask --now firewalld
As you can see from the output the mask command simply creates a symlink from the firewalld service to /dev/null
:
Created symlink from /etc/systemd/system/firewalld.service to /dev/null.
Great! We have now established that the Firewall has been stopped and disabled.