CentOS should be a Linux image commonly used by our friends in China. After all, there are many domestic documents provided, and software compatibility is preferred. With the security management of the server, we need to set the security of the server, including firewall settings. However, some software runs very fastidiously, and some ports need to be closed. Or the firewall needs loose settings. Here we can directly turn off the firewall.
Here Lao Zuo sorts out three common methods and commands for closing the CentOS firewall.
Method 1: Use the systemctl command
Execute the following command to stop the firewalld service:
sudo systemctl stop firewalld
Execute the following command to disable the firewalld service so that it does not automatically run when the system starts:
sudo systemctl disable firewalld
Method 2: Use the service command
Execute the following command to stop the firewalld service:
sudo service firewalld stop
Execute the following command to disable the firewalld service so that it does not automatically run when the system starts:
sudo chkconfig firewalld off
Method 3: Use the iptables command (applicable to CentOS 6 and earlier versions)
Execute the following command to clear the iptables rule:
sudo iptables -F
Execute the following command to disable the iptables service so that it does not automatically run when the system starts:
sudo chkconfig iptables off
To sum up, the above three methods choose the appropriate methods to close the firewall according to different system versions and function commands.
Scan the code to follow the official account
Get more news about webmaster circle!
Entrepreneurship, operation and new knowledge