如何关闭和开启Centos7防火墙

2026-02-14 02:25:11

1、首先查看防火墙的启动状态,显示是:not running,是关闭的状态,开启和关闭防火墙

firewall-cmd –state

systemctl start firewalld.service

systemctl stop firewalld.service

如何关闭和开启Centos7防火墙

2、查看自启动的服务,左边是服务名称,右边是状态,enabled是开机启动,disabled是开机不启动。

systemctl list-unit-files

如何关闭和开启Centos7防火墙

3、前面为临时打开关闭防火墙,reboot重启电脑后又会恢复成开启的状态,如果是想重启后防火墙还是处于关闭的状态,就可以使用命令。disable是开启不启动,enable是开启自启动。

systemctl list-unit-files | grep firewalld

systemctl disable firewalld.service

systemctl enable firewalld.service

如何关闭和开启Centos7防火墙

4、查看防火墙iptables的配置文件。

如何关闭和开启Centos7防火墙

猜你喜欢