How to Use and Enable/Disable Firewall in Centos7/8, RHEL 7/8

How to Disable firewall in Linux

How to Check and Disable Firewall  in Centos7/8, RHEL 7/8

As we know the firewall is very important for our system or server security. In some cases where you have an external firewall in your network or you are using a different firewall, you need to disable the firewall. Few sysadmins disable the firewall for any application too but we recommend that for a case of application configure the firewall, do not disable it.
In this article, we will see how to check and disable the firewall in Linux.

Disable Firewall :

Step -1 Check firewall status with the below command

 

#  systemctl status firewalld
systemctl status firewalld
This will show the current status of the firewall. Now it is on active showing.

Step -2 Disable the firewall with below command

#  systemctl stop firewalld
This command stops the firewall temporarily but if you reboot or reload it will be active again.

Step – 3 Permanent disable it with the below command

#  systemctl disable firewalld
systemctl disable firewalld
This will disable the firewall permanently. After this, you can manually start firewall.

Step -4 Check firewall status with the below command

#  systemctl status firewalld
systemctl status firewalld dead
Now you have successfully disabled the firewall of your Linux machine.
In case you want to Enable Firewall again. Follow the below procedure :

Enable Firewall

Step -1 Start firewall with below command

#  systemctl start firewalld
This will start firewall temporarily if it is disabled using disable command

Step -2 Enable the firewall permanently with the below command

 #  systemctl enable  firewalld
This will enable the firewall permanently.

Add a Port or Service  in the Firewall

 

# firewall-cmd --zone=public --add-port=8080/tcp --permanent
# firewall-cmd --zone=public --add-service=tomcat --permanent
# firewall-cmd --reload
This will add ports and services to firewall
At this point, you know how to disable and enable the firewall on RHEL 7/8  and Centos 7/8. Share this if it is helpful.

Leave a Comment

Your email address will not be published. Required fields are marked *