我们需要将360网站卫士的IP段添加进服务器的白名单中,防止网站卫士服务被误认为攻击而屏蔽IP,以下为360网站卫士的IP段:
218.30.117.*
218.30.118.*
123.125.160.*
182.118.33.*
制作一个shell的脚本执行之后添加到iptables防火墙规则中
[root@ithov ~]# vi wzb_firewall.sh #建立执行的脚本文件
[root@ithov ~]# chmod +x wzb_firewall.sh #赋于执行权限
[root@ithov ~]# ./wzb_firewall.sh
正在添加防火墙白名单,请稍候...
iptables:将防火墙规则保存到 /etc/sysconfig/iptables:[确定]
添加防火墙白名单成功,现在您可以正常使用360网站卫士防护服务和在线加速了!
执行成功后,会看到“添加防火墙白名单成功,现在您可以正常使用360网站卫士的防护和加速服务了!” 的提示。
脚本内容如下:
#!/bin/bash
echo "正在添加防火墙白名单,请稍候..."
iptables -A INPUT -s 218.30.117.0/24 -j ACCEPT
iptables -A INPUT -s 218.30.118.0/24 -j ACCEPT
iptables -A INPUT -s 123.125.160.0/24 -j ACCEPT
iptables -A INPUT -s 182.118.33.0/24 -j ACCEPT
service iptables save
echo "添加防火墙白名单成功,现在您可以正常使用360网站卫士防护服务和在线加速了!"
重新启动防火墙
[root@localhost ~]# service iptables restart
iptables:将链设置为政策 ACCEPT:filter [确定]
iptables:清除防火墙规则:[确定]
iptables:正在卸载模块:[确定]
iptables:应用防火墙规则:[确定]
iptables:载入额外模块:nf_conntrack_ftp [确定]
查看iptables规则是否生效
[root@ithov ~]# iptables -nL
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:80
REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
ACCEPT all -- 218.30.117.0/24 0.0.0.0/0
ACCEPT all -- 218.30.118.0/24 0.0.0.0/0
ACCEPT all -- 123.125.160.0/24 0.0.0.0/0
ACCEPT all -- 182.118.33.0/24 0.0.0.0/0
Chain FORWARD (policy ACCEPT)
target prot opt source destination
REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
已经正常生效了,现在使用稳定多啦!