Several methods to turn off the firewall in Linux

1. Temporarily turn off the firewall

Disable firewall:

systemctl stop firewalld

Enable/disable the firewall:
View firewalld status:

systemctl status firewalld    #查看防火墙状态

Running is displayed, which means the firewall is turned on.

2. How to check whether your firewall belongs to iptables or firewalld

Run command:

sudo firewall-cmd --state 

iptables firewall, the content will appear:

iptables: Firewall is not running.
iptables: Firewall is running.            //如果启动了会出现这个

firewalld firewall, the content will appear:

running

2. Permanently turn off the firewall (via command):

1. For iptables firewall:

sudo service iptables stop
sudo chkconfig iptables off

2. For firewalld firewall:

sudo systemctl stop firewalld
sudo systemctl disable firewalld

3. Permanently turn off the firewall (via configuration file):

1. For iptables firewall:
Then delete all rules in the file, save and exit the file. This will completely disable the iptables firewall.

sudo vi /etc/sysconfig/iptables

2. For firewalld firewall:
Find the Enabled field in the file and change its value from yes to no. Then save and exit the file. This will completely disable the firewalld firewall

sudo vi /etc/firewalld/firewalld.conf

Please note that turning off the firewall may result in increased system security risks, so it is recommended to do so only after ensuring that other security measures have been taken. Also, which command to use depends on your system and firewall type, so make sure you understand the type of firewall you are using and the correct usage of the associated commands.

Guess you like

Origin blog.csdn.net/weixin_46012189/article/details/132462292