Archives 如何对付那些发了疯的蜘蛛们
Post
Cancel

如何对付那些发了疯的蜘蛛们

最近两天,二奶机经常过热关机,毕竟是老机器了,经不起过高的温度。什么原因呢?top一下发现apache占用CPU高达30%。这就诡异了,我的网站啥时候也没有这么高的访问量啊。查了下access_log,居然有无数的IP来访。whois加上Google,原来是一堆的蜘蛛,大部分来自腾讯和搜狗。简直是疯狗,同时放出几十个蜘蛛来爬,这哪受得了!

我的路由器没有防火墙功能,所以只好在二奶机上弄了。还好上次编内核的时候把iptables编进去了,否则我估计这种天气,内核都编不下去就要关机了。折腾了一番,终于搞定。Gentoo对iptables的支持还不错,emerge了之后/etc/init.d里面就有了启动脚本,简单地看了一下也就会用了。现在我的iptables里面是这种状况,列出来给需要的人参考一下(基本上我把IP在中国的都给踢出去了,谁知道它们在找什么):

# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination
all  –  anywhere             anywhere
DROP       all  –  124.115.4.0/24       anywhere
DROP       all  –  124.115.0.0/24       anywhere
DROP       all  –  122.194.170.0/24     anywhere
DROP       all  –  114.80.93.56         anywhere
DROP       all  –  122.81.25.8          anywhere
DROP       all  –  123.125.66.0/24      anywhere
DROP       all  –  218.5.3.149          anywhere
DROP       all  –  220.181.94.222       anywhere
Chain FORWARD (policy ACCEPT)
target     prot opt source               destination
Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
最后简单说一下iptables的用法,网上到处都是,不多啰嗦了。
iptables -A INPUT -s -j DROP </div>
This post is licensed under CC BY 4.0 by the author.

很久没更新了,说说翻墙的事儿吧

又见村上

Comments powered by Disqus.