CentOS7之后 , 系统已经推荐了firewall防火墙 , 而不是iptables
1、安装
yum install -y firewalld
yum install -y firewall-config
2、配置
开启firewall服务
#重启firewalld服务(注意有个d)
systemctl restart firewalld
#设置开机自启动(注意有个d)
systemctl enable firewalld
特别提醒: firewall 和 iptables冲突 , 需要禁用其中一个
#停止iptables服务
systemctl stop iptables
#禁用iptables服务
systemctl mask iptables
3、使用
启动
systemctl start firewalld # 启动
systemctl status