欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

利用CentOS系统IPtables防火墙添加360网站卫士节点IP白名单

shiping1 的头像
伴随着百度与加速乐合作的分离,百度也相继推出了自己的加速产品:百度云加速,不过,对于广大的站长们来说,百度云加速免费版本提供的节点太少了,而且在流量、DDoS防御上面做了一定的限制,以下为百度云加速名个套餐价格的对比:

利用CentOS系统IPtables防火墙添加360网站卫士节点IP白名单的图片 来自晓风依然 1

相信,看了以上的数据,免费的百度云加速感觉有一些像鸡肋,相比之下,360网站卫士在这方面可能做得更好一些,360网站卫士是集网站防护、加速、运营 为一体的一站式管理服务平台。为站长免费提供网站防火墙、DDoS保护、 CC保护、CDN加速、智能DNS解析、统计报表查询、页面压缩、缓存加速、和网站APP等服务。

利用CentOS系统IPtables防火墙添加360网站卫士节点IP白名单的图片 来自晓风依然 2

小编今天体验了一下360网站卫士的产品,发现添加之后会产生502的错误,为了在使用加速产品之后,让网站不出现异常的502错误等情况

利用CentOS系统IPtables防火墙添加360网站卫士节点IP白名单的图片 来自晓风依然 3

我们需要将360网站卫士的IP段添加进服务器的白名单中,防止网站卫士服务被误认为攻击而屏蔽IP,以下为360网站卫士的IP段:

183.136.133.0-183.136.133.255

220.181.55.0-220.181.55.255

101.226.4.0-101.226.4.255

180.153.235.0-180.153.235.255

122.143.15.0-122.143.15.255

27.221.20.0-27.221.20.255

202.102.85.0-202.102.85.255

61.160.224.0-61.160.224.255

112.25.60.0-112.25.60.255

182.140.227.0-182.140.227.255

221.204.14.0-221.204.14.255

222.73.144.0-222.73.144.255

61.240.144.0-61.240.144.255

113.17.174.0-113.17.174.255

125.88.189.0-125.88.189.255

120.52.18.0-120.52.18.255

制作一个shell的脚本执行之后添加到iptables防火墙规则中


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
[root@ithov ~]# vim add_iptables.sh 
然后按i,进入编辑模式 然后输入内容如下
 #!/bin/bash

echo "晓风依然 http://www.ith8.com 整理提供脚本内容"

echo "正在添加防火墙白名单,请稍候..."

iptables -A INPUT -s 183.136.133.0/24 -j ACCEPT

iptables -A INPUT -s 220.181.55.0/24 -j ACCEPT

iptables -A INPUT -s 101.226.4.0/24 -j ACCEPT

iptables -A INPUT -s 180.153.235.0/24 -j ACCEPT

iptables -A INPUT -s 122.143.15.0/24 -j ACCEPT

iptables -A INPUT -s 27.221.20.0/24 -j ACCEPT

iptables -A INPUT -s 202.102.85.0/24 -j ACCEPT

iptables -A INPUT -s 61.160.224.0/24 -j ACCEPT

iptables -A INPUT -s 112.25.60.0/24 -j ACCEPT

iptables -A INPUT -s 182.140.227.0/24 -j ACCEPT

iptables -A INPUT -s 221.204.14.0/24 -j ACCEPT

iptables -A INPUT -s 222.73.144.0/24 -j ACCEPT

iptables -A INPUT -s 61.240.144.0/24 -j ACCEPT

iptables -A INPUT -s 113.17.174.0/24 -j ACCEPT

iptables -A INPUT -s 125.88.189.0/24 -j ACCEPT
iptables -A INPUT -s 120.52.18.0/24 -j ACCEPT

service iptables save

echo "添加防火墙白名单成功,现在您可以正常使用360网站卫士防护服务和在线加速了!"

编辑完成后按esc然后:wq 保存


1
2
3
 [root@ithov ~]# chmod +x add_iptables.sh 

[root@ithov ~]# ./add_iptables.sh

重新启动防火墙


1
[root@localhost ~]# service iptables restart

iptables:将链设置为政策 ACCEPT:filter [确定]

iptables:清除防火墙规则:[确定]

iptables:正在卸载模块:[确定]

iptables:应用防火墙规则:[确定]

iptables:载入额外模块:nf_conntrack_ftp [确定]

查看iptables规则是否生效


1
[root@ithov ~]# iptables -nL

已经正常生效了,现在使用稳定多啦!

来自 http://www.ith8.com/html/917.html

普通分类: