This article will demonstrate how to manage a firewall on a Redhat server. Firewall functions that will be covered include how to check the firewall status, start, stop, enable, and disable it. The examples below were performed on RHEL 8.x.
The default firewall on RHEL 8 is firewalld and is enabled by default. If your Redhat instance is on a local network protected by a perimeter firewall you may prefer to disable the local firewalld firewall. If the server is public you should strongly consider leaving the firewall enabled.
Redhat Firewall Status
The first step in managing the local Redhat firewall is to check its status. If it is a new instance, the status should be enabled by default. If you’re troubleshooting an issue on a server installed by a previous systems administrator, you should most definitely check the status first.
To check the RHEL firewall status, use the systemctl utility.
systemctl status firewalld
The output will show if the firewall is enabled. If it is enabled, it will automatically start after a reboot.
If the firewall is not running, you will see the following message.
* firewalld is not running
Redhat Firewall Rules
To display the rules configured in your firewall run the following command.
firewall-cmd --list-all
Redhat Enable Firewall
To enable the firewall, run the following command.
systemctl enable firewalld
Disable Firewall
To disable the firewall, run the following command.
systemctl disable firewalld
Start Firewall
To start the firewall, run the following command.
systemctl start firewalld
Stop Firewall
To stop the firewall, run the following command.
systemctl stop firewalld
Conclusion
This article has demonstrated how to run various functions within firewalld in Redhat. We hope you have learned how to start, stop, enable, disable, and check the firewall status. Let us know in the comments if you have any questions or would like to see additional examples of how to manage a firewall in Linux. If you liked this post, check our additional articles we have written.
Leave a Reply