CentOS7默认的防火墙不是iptables,而是firewalle.
禁用/停止自带的firewalld服务
#停止firewalld服务
systemctl stop firewalld
#禁用firewalld服务
systemctl mask firewalld
CentOS7安装iptables防火墙
#先检查是否安装了iptables
service iptables status
#安装iptables
yum install -y iptables
#升级iptables
yum update iptables
#安装iptables-services
yum install iptables-services
Linux下iptables禁用和开放端口
https://www.cnblogs.com/zongfa/p/7967935.html
iptables设置ping协议ICMP
iptables -t filter -A INPUT -p icmp --icmp-type 0 -j ACCEPT #允许请求进来
iptables -t filter -A OUTPUT -p icmp --icmp-type 8 -j ACCEPT #允许响应出去
执行完上述的命令之后,可在另外一台主机上实现对本机的ping测试
type 8为ping 命令请求信号
type 0为ping 命令响应信号
iptales -F #清空防火墙规则
/etc/init.d/iptables save #保存
service iptables stop #关闭防火墙
chkconfig iptables off