CentOS 7.0 预设使用的是 firewall 作为防火墙,使用 iptables 必须重新设定一下
1 、直接关闭防火墙
systemctl stop firewalld.service #停止 firewall
systemctl disable firewalld.service #禁止 firewall 开机启动
2 、设定 iptables service
yum -y install iptables-services
如果要修改防火墙配置,如增加防火墙埠 3306
vi /etc/sysconfig/iptables
增加规则
-A INPUT -m state –state NEW -m tcp -p tcp –dport 3306 -j ACCEPT
储存退出后
systemctl restart iptables.service #重启防火墙使配置生效
systemctl enable iptables.service #设定防火墙开机启动
最后重启系统使设定生效即可。

 
原文连结:http://www.cnblogs.com/silent2012/archive/2015/07/28/4682770.html