How to stop/start firewall on RHEL 8 / CentOS 8

The firewall on RHEL 8 / CentOS 8 Linux system is enabled by default allowing for only few services to receive incoming traffic. FirewallD is the default daemon responsible for firewall security feature onRHEL 8 / CentOS 8 Server.

NOTE
The nftables framework replaces iptables as a default network packet filtering feature on RHEL 8.

The following is a list of default firewall opened ports and configured settings on RHEL 8 / CentOS 8 Linux system using the firewalld dynamic firewall daemon:

# firewall-cmd --list-all
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: enp0s3
  sources: 
  services: cockpit dhcpv6-client ssh
  ports: 
  protocols: 
  masquerade: no
  forward-ports: 
  source-ports: 
  icmp-blocks: 
  rich rules: 

In this tutorial you will learn:

  • How to check the firewall status onRHEL 8 / CentOS 8.
  • How to stop firewall on RHEL 8 / CentOS 8.
  • How to start firewall on RHEL 8 / CentOS 8.
  • How to permanently disable firewall on RHEL 8 / CentOS 8.
  • How to enable firewall to start after reboot.

Stopping firewall on Red Hat Enterprise Linux 8.

Stopping firewall on Red Hat Enterprise Linux 8.



Software Requirements and Conventions Used

Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Red Hat Enterprise Linux 8
Software N/A
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

How to stop/start firewall on Redhat 8 step by step instructions

  1. To check firewall status execute the following command:
    # 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 Sun 2018-11-25 15:08:56 EST; 8min ago
         Docs: man:firewalld(1)
     Main PID: 4567 (firewalld)
        Tasks: 2 (limit: 24007)
       Memory: 24.4M
       CGroup: /system.slice/firewalld.service
               └─4567 /usr/libexec/platform-python -s /usr/sbin/firewalld --nofork --nopid
    
  2. Stop firewall by running the following command:
    # service firewalld stop
    OR
    # systemctl stop firewalld
    
  3. To permanently disable firewall even after the RHEL 8 / CentOS 8 system reboot execute:
    # systemctl disable firewalld
    
  4. To start firewall after it was stopped execute:
    # service firewalld start
    OR
    # systemctl start firewalld
    
  5. To enable the firewall to start after the system reboot run:
    # systemctl enable firewalld