Centos7iptables安装

#先检查是否安装了iptables
service iptables status
#安装iptables
yum install -y iptables
#升级iptables 
yum update iptables
#安装iptables-services
yum install iptables-services

#停止firewalld服务
systemctl stop firewalld
#禁用firewalld服务
systemctl disable firewalld


#注册iptables服务
#相当于以前的chkconfig iptables on
systemctl enable iptables.service
#开启服务
systemctl start iptables.service
#查看状态
systemctl status iptables.service


firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --reload

firewall-cmd --zone=public --add-port=3306/tcp --permanent
firewall-cmd --reload

iptables -I INPUT -p tcp --dport 80 -j ACCEPT
iptables-save
-------------本文结束感谢您的阅读-------------