Redhat Disable Firewall – start, stop, enable, disable

firewalld is the default firewall on Red Hat Enterprise Linux, and it’s enabled by default, but it’s possible to disable the firewall on Redhat, and you’ll also see how to check firewall status in Linux. Normally, there should not be a need to disable the firewall, but it may be quite handy for testing purposes or other scenarios. In this tutorial, you’ll see how to check the status of firewalld, enable or disable the service from starting automatically upon system boot, and how to stop or start the firewalld service in RHEL.

In this tutorial you will learn:

  • Stop or start the firewall in RHEL
  • Enable or disable automatic starting of firewall
  • How to check the status of firewalld service in RHEL
Redhat Disable Firewall - start, stop, enable, disable
Redhat Disable Firewall – start, stop, enable, disable
Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Red Hat Enterprise Linux
Software firewalld
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 check firewall status in Red Hat Linux




To see how to check firewall status in Red Hat Linux, use the following systemctl command. This will tell you if the service is running or not.

$ systemctl status firewalld

Output of command:

firewalld.service - firewalld - dynamic firewall daemon
     Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2021-10-16 12:26:14 -05; 5s ago
       Docs: man:firewalld(1)
   Main PID: 4761 (firewalld)
      Tasks: 2 (limit: 2312)
     Memory: 27.4M
        CPU: 1.553s
     CGroup: /system.slice/firewalld.service
             └─4761 /usr/bin/python3 -s /usr/sbin/firewalld --nofork --nopid
			 
Oct 16 12:26:12 localhost.localdomain systemd[1]: Starting firewalld - dynamic firewall daemon...
Oct 16 12:26:14 localhost.localdomain systemd[1]: Started firewalld - dynamic firewall daemon.

Managing system firewall on Red Hat Enterprise Linux
Managing system firewall on Red Hat Enterprise Linux

From the above output, we can see that the firewall is enabled, which means it will start automatically after reboot and that it is also currently active. Furthermore, you can even check all currently applied rules with:

# iptables-save

View Configured Rules

You can see what rules are currently configured in your firewall by executing the following command in terminal.

# firewall-cmd --list-all

This is a recommended step to perform before you decide to disable the Redhat firewall, because you may have rules configured that you did not realize. Disabling the firewall will cause these rules to no longer be enforced.

Redhat Disable Firewall, start/stop

The firewall on a Red Hat Linux system can be stopped by executing the following Linux command:

$ sudo systemctl stop firewalld

To turn the firewall back on, use this command:

$ sudo systemctl start firewalld

Redhat Disable Firewall, enable/disable

Enabling the firewall means that the service will start automatically when the system boots up. And disabling it means that it won’t start up automatically.

And in order to completely disable Redhat firewall, so it would no load after reboot, run:

$ sudo systemctl disable firewalld

Now the firewall would not start after system’s reboot. To enable the firewall again, run:



$ sudo systemctl enable firewalld

Closing Thoughts

In this tutorial, you learned how to manage the system firewall in RHEL. This included options such as to start, stop, enable, or disable the firewall in Redhat as well as to check the current status of firewalld and its configured rules.