飞总吃不饱

Cent OS 7 查看和关闭防火墙

2019-08-27 · 2 min read
开发

CentOS 7.0默认使用的是firewall作为防火墙
查看防火墙状态

firewall-cmd –state

停止firewall

systemctl stop firewalld.service

禁止firewall开机启动

systemctl disable firewalld.service

2021-2-20 补充

systemctl status firewalld 查看防火墙状态
systemctl stop firewalld 停止防火墙
systemctl disable firewalld 禁止防火墙
systemctl start firewalld 启动防火墙

systemctl是从centos7.x开始引入的一个服务管理工具命令,融合了之前的service和chkconfig的功能于一体。

在7版本以前或者没有安装systemclt的minimal版本,可以使用service控制防火墙。

service iptables status 查看防火墙状态
service iptables stop 临时关闭防火墙
service iptables start 启动防火墙
service iptables restart 重启防火墙
chkconfig iptables off 永久关闭防火墙
chkconfig iptables on 永久关闭后开启防火墙

在CentOS 7里有几种防火墙共存:firewalld、iptables、ebtables。默认是使用firewalld来管理netfilter子系统,不过底层调用的命令仍然是iptables等。
firewalld跟iptables比起来,不好的地方是每个服务都需要去设置才能放行,因为默认是拒绝。而iptables里默认是每个服务是允许,需要拒绝的才去限制。

版权所有 © 2015-2021 SingFind. 飞总の博客 | All Rights Reserved
鲁ICP备19002147号-1 | Powered by Gridea