1.关闭 firewall 防火墙
systemctl stop firewalld.service
2.禁止 firewall 开机自启动
systemctl disable firewalld.service
3.查看 firewall 防火墙状态
systemctl status firewalld.service
结果:
4.安装 iptables
yum install -y iptables
5.安装 iptables_services
yum install iptables-services
6.配置防火墙
vi /etc/sysconfig/iptables
7.允许80端口和3306端口通过防火墙
8.设置 iptables 开机启动
systemctl enable iptables.service
9.开启防火墙
systemctl start iptables.service
10.查看状态
systemctl status iptables.service
结果:
如果是云服务器,记得配置安全组