一、直接关闭防火墙tcp
systemctl stop firewalld.service; #中止firewallrest
systemctl disable firewalld.service; #禁止firewall开机启动ip
二、安装并启动 iptables service,以及设置开机自启table
yum -y install iptables-services;#安装iptables配置
systemctl start iptables;#启动iptablesiptables
systemctl enable iptables;#自启动iptablesservice
systemctl start ip6tables;#启动ip6tables(不须要能够跳过)防火墙
systemctl enable ip6tables;#自启动ip6tables(不须要能够跳过)yum
三、配置iptables servicetop
vi /etc/sysconfig/iptables;#如增长防火墙端口3306和一些经常使用端口 80、8080等
增长规则:
-A INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT;
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT;
-A INPUT -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT;
保存退出后。
三、重启 iptables service,
systemctl restart iptables.service #重启防火墙使配置生效
四、最后重启系统使设置生效便可
reboot;