怎样阻止别人疯狂爬行网站,如下 log,该怎么做,求大神支招

2014-11-24 21:03:50 +08:00
 AlanZhang
static-189-206-125-34.alestra.net.mx - - [24/Nov/2014:12:57:51 +0000] "GET /directory/application/2436/era-solar?utm_source=ENF&utm_medium=Craft-Lights-%28Ornamental-Figures%29&utm_content=2436&utm_campaign=profiles_application HTTP/1.1" 200 31266 "-" "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt; DTS Agent"
static-189-206-125-34.alestra.net.mx - - [24/Nov/2014:12:57:51 +0000] "GET /directory/installer/24675/dalian-new-extension-energy-engineering HTTP/1.1" 200 31904 "-" "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt; DTS Agent"
194.219.156.42 - - [24/Nov/2014:12:57:52 +0000] "GET /directory/installer/47239/influx-renewables?utm_source=ENF&utm_medium=United+Kingdom&utm_content=47239&utm_campaign=profiles_installer HTTP/1.1" 200 5943 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/7.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; MASM; .NET4.0C; .NET4.0E; InfoPath.3; ms-office)"
4831 次点击
所在节点    问与答
29 条回复
AlanZhang
2014-11-24 21:09:46 +08:00
这个域名static-189-206-125-34.alestra.net.mx在疯狂的爬行网站(导致不停宕机),怎么阻止它
AlanZhang
2014-11-24 21:16:20 +08:00
尼玛,还有个贱域名疯狂爬行: host-2.airlink.hu
Radeon
2014-11-24 21:17:24 +08:00
iptables加一条DROP掉就行了
AlanZhang
2014-11-24 21:24:56 +08:00
@Radeon 求具体命令,多谢了。
abelyao
2014-11-24 21:27:34 +08:00
@AlanZhang 话说这个域名怎么拼起来好像一个手机号码… 18920612534… 虽然我觉得应该是个 IP 地址比较准确……
Radeon
2014-11-24 21:31:22 +08:00
http://www.cyberciti.biz/faq/how-do-i-block-an-ip-on-my-linux-server/

建议block IP而不是域名。这样节省反向域名查询的成本
em70
2014-11-24 21:35:22 +08:00
写个脚本用这个awk命令
awk '{print $1 }' /var/log/httpd/access_log.20141124 |sort |uniq -c|sort -nr|head -n 100

每一个小时检查一下,把访问量最高的IP列出来,超过一定量就自动封掉
AlanZhang
2014-11-24 21:35:29 +08:00
@Radeon 多谢,我已经block了那两个IP,但是基本等于无效。
Radeon
2014-11-24 21:37:02 +08:00
@AlanZhang 又有新的IP冒出来?
AlanZhang
2014-11-24 21:41:41 +08:00
@Radeon 关键是这个static-189-206-125-34.alestra.net.mx查不到IP啊。
AlanZhang
2014-11-24 21:42:16 +08:00
@em70 脚步非常好,第一是 32132 static-189-206-125-34.alestra.net.mx, 这个要怎么封?
em70
2014-11-24 21:46:04 +08:00
@AlanZhang ping一下看看IP多少,我这边测试ping不通,你那能解析出来域名,肯定能ping吧
lmaq
2014-11-24 21:47:55 +08:00
你的日志竟然没有来路IP = =;
Radeon
2014-11-24 21:48:17 +08:00
关掉apache的DNS lookup。再说ping一下不就查到ip了?
AlanZhang
2014-11-24 22:10:20 +08:00
@lmaq
@Radeon 求助啊,该死的static-189-206-125-34.alestra.net.mx还在无限增长,却查不到IP!
em70
2014-11-24 22:11:14 +08:00
@AlanZhang ping了没有
ETiV
2014-11-24 22:13:05 +08:00
这种都是反着读的,34.125.206.189

DROP这个试试
AlanZhang
2014-11-24 22:29:37 +08:00
@ETiV 多谢。 我试了,apache死了重启了,带回看效果。 请问反着读是什么意思?这IP怎么得到的?
AlanZhang
2014-11-24 22:36:31 +08:00
@Radeon apache的DNS lookup已经关掉了,不过,static-189-206-125-34.alestra.net.mx这个地址是ping不到的
Radeon
2014-11-24 22:41:51 +08:00
~$ ping static-189-206-125-34.alestra.net.mx
PING static-189-206-125-34.alestra.net.mx (202.102.110.203): 56 data bytes

这个202.102.110.203 DROP一下

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/148982

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX