How to turn off and turn on iptables and firewalld firewalls by centos, Red Hat and Ubuntu
In this issue, the editor will bring you about centos, Red Hat and Ubuntu how to turn off and turn on iptables and firewalld firewalls. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.
There are different distributions of the Linux system, and different distributions have different commands to turn on or off the system firewall. Please match the operation commands of the following distributions according to the version.
CentOS 5/CentOS 6
On CentOS 5 and CentOS 6 systems, refer to the following information on how to turn on the firewall, turn off the firewall, and view the operational status of the firewall:
Turn on the firewall
Service iptables start
Turn off the firewall
Service iptables stop
View firewall running status
Service iptables statusCentOS 7/Red Hat 7/Alibaba Cloud Linux 2
In CentOS 7, Red Hat, and Alibaba Cloud Linux 2
In the system, please refer to the following information about how to turn on the firewall, turn off the firewall, and view the running status of the firewall:
Turn on the firewall
Systemctl start firewalld.service
Turn off the firewall
Systemctl stop firewalld.service
View firewall running status
Firewall-cmd-stateUbuntu
In the Ubuntu system, refer to the following information about how to turn on the firewall, turn off the firewall, and view the running status of the firewall:
Turn on the firewall
Ufw enable
Turn off the firewall
Ufw disable
View firewall running status
Ufw statusDebian
In the Debian system, there is no firewall installed by default. You can delete the relevant shielding rules by emptying the firewall policy. The specific actions are as follows:
Note: be sure to back up the firewall policy before emptying the policy.
Back up the firewall policy by executing the following command.
Touch [$Iptables] iptables-save > [$Iptables]
Note: [$Iptables] is the backup file address of the firewall policy.
Execute the following command to clear the firewall policy.
Iptables-F above is the centos, Red Hat and Ubuntu shared by the editor on how to turn off and enable iptables and firewalld firewalls. If you happen to have similar doubts, please refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.