Centos7关闭防火墙

执行命令

systemctl status firewalld.service


时报错Unit firewalld.service could not be found.
然后查了很多资料都说执行下面这个就解决了

systemctl unmask firewalld.service

然而又报错了
Failed to start firewalld.service: Unit not found.



最后终于找到问题

其实就是要排除你们是否安装了这个firewalld

yum install firewalld
systemctl unmask firewalld
systemctl enable firewalld
systemctl start firewalld

依次执行以上命令后发现终于ok了

其他命令

systemctl start firewalld.service //开启防火墙
systemctl stop firewalld.service //关闭防火墙
systemctl enable firewalld.service //设置开机自动启动
systemctl disable firewalld.service //设置关闭开机制动启动
firewall-cmd --reload //在不改变状态的条件下重新加载防火墙