How to disable firewall on CentOS 8 Linux

Updated on February 17, 2022

This tutorial will help you to learn how to disable firewall on CentOS 8 and many other service activities like:

  • How to enable firewall on CentOS 8
  • How to check the status of firewall
  • How to stop firewall on CentOS 8
  • How to start firewall on CentOS 8
What is FirewallD?

FirewallD is a firewall management tool on CentOS 8. It helps to dynamically configure the firewall rules with support for the zone-based firewall. Zone-based firewalls are network security systems that monitor traffic and take actions based on a set of defined rules applied against incoming/outgoing packets.

However, iptables is also another tool that manages the firewall rules on CentOS 8.

The main difference between firewallD and iptables are:

  • The storage of configuration – iptables stores config in /etc/sysconfig/iptables-config whereas firewalld stores it in various XML files in /usr/lib/firewalld/ and /etc/firewalld/.
  • Every single change in iptables needs flushing all the old rules and reading all the new rules whereas with firewalld there is no re-creating of all the rules; only the difference is applied.
  • Firewalld can change the settings during the run-time without existing connections being lost.

How to check firewall status on CentOS 8

[root@upgrade-centos ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2022-02-16 15:41:20 IST; 57s ago
     Docs: man:firewalld(1)
 Main PID: 748 (firewalld)
    Tasks: 2 (limit: 11361)
   Memory: 32.4M
   CGroup: /system.slice/firewalld.service
           └─748 /usr/libexec/platform-python -s /usr/sbin/firewalld --nofork --nopid

Feb 16 15:41:18 upgrade-centos.novalocal systemd[1]: Starting firewalld - dynamic firewall daemon...
Feb 16 15:41:20 upgrade-centos.novalocal systemd[1]: Started firewalld - dynamic firewall daemon.

How to stop firewall on CentOS 8

[root@upgrade-centos ~]# systemctl stop firewalld

[root@upgrade-centos ~]# systemctl status firewalld

● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Wed 2022-02-16 15:43:54 IST; 1s ago
Docs: man:firewalld(1)
Process: 748 ExecStart=/usr/sbin/firewalld --nofork --nopid $FIREWALLD_ARGS (code=exited, status=0/SUCCESS)
Main PID: 748 (code=exited, status=0/SUCCESS)

Feb 16 15:41:18 upgrade-centos.novalocal systemd[1]: Starting firewalld - dynamic firewall daemon...
Feb 16 15:41:20 upgrade-centos.novalocal systemd[1]: Started firewalld - dynamic firewall daemon.
Feb 16 15:41:20 upgrade-centos.novalocal firewalld[748]: WARNING: AllowZoneDrifting is enabled. This is considered an insecure configuration option. It will be removed in a future release. Please consider disabling it now.
Feb 16 15:43:54 upgrade-centos.novalocal systemd[1]: Stopping firewalld - dynamic firewall daemon...
Feb 16 15:43:54 upgrade-centos.novalocal systemd[1]: firewalld.service: Succeeded.
Feb 16 15:43:54 upgrade-centos.novalocal systemd[1]: Stopped firewalld - dynamic firewall daemon.

How to disable firewall on CentOS 8

[root@upgrade-centos ~]# systemctl disable firewalld

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

How to enable firewall on CentOS 8

[root@upgrade-centos ~]# systemctl enable firewalld

Created symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service → /usr/lib/systemd/system/firewalld.service.
Created symlink /etc/systemd/system/multi-user.target.wants/firewalld.service → /usr/lib/systemd/system/firewalld.service.

How to start firewall on CentOS 8

[root@upgrade-centos ~]# systemctl start firewalld

[root@upgrade-centos ~]# systemctl status firewalld

● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2022-02-16 15:46:51 IST; 1s ago
Docs: man:firewalld(1)
Main PID: 5466 (firewalld)
Tasks: 2 (limit: 11361)
Memory: 23.5M
CGroup: /system.slice/firewalld.service
└─5466 /usr/libexec/platform-python -s /usr/sbin/firewalld --nofork --nopid

Feb 16 15:46:50 upgrade-centos.novalocal systemd[1]: Starting firewalld - dynamic firewall daemon...
Feb 16 15:46:51 upgrade-centos.novalocal systemd[1]: Started firewalld - dynamic firewall daemon.

How to allow/remove ports in firewallD on CentOS 8

Here is an article on how to Open HTTP 80 and HTTPS 443 ports in firewalld on CentOS 8. This works for all the webservers such as Apache, Nginx etc., By default, these ports shall not be opened. The same procedure can be extended for other ports or services too.

Was this article helpful?

Related Articles

Leave a Comment