http://blog.csdn.net/zhldt2008/article/details/52626892
CentOS 7.0 uses firewall as a firewall by default, and this is iptables firewall instead.
1. Close firewall:
Systemctl Stop Firewalld.service
Systemctl Disable Firewalld.service
Systemctl Mask Firewalld.service
2. Install iptables Firewall
Yum Install Iptables-services-y
3. Startup settings Firewall
# Systemctl Enable Iptables
# Systemctl Start iptables
If a startup failure occurs, enter the service iptables Save command, iptables start normal
4. View firewall status
Systemctl status iptables 5 edit firewall, add port
Vi/etc/sysconfig/iptables #编辑防火墙配置文件
-A input-m state--state new-m tcp-p TCP--dport 22-j ACCEPT
-A input-m state--state new-m tcp-p TCP--dport 21-j ACCEPT
-A input-m state--state new-m tcp-p TCP--dport 80-j ACCEPT
-A input-m state--state new-m tcp-p TCP--dport 443-j ACCEPT
-A input-m state--state new-m tcp-p TCP--dport 3306-j ACCEPT
: wq! #保存退出
3. Reboot the configuration, reboot the system
Systemctl Restart Iptables.service #重启防火墙使配置生效
Systemctl Enable Iptables.service #设置防火墙开机启动