封美国的ip段
http://www.ipdeny.com/ipblocks/data/countries/us.zone
#?wget?http://www.ipdeny.com/ipblocks/data/countries/us.zone有了國家的所有 IP 地址,要想屏蔽這些 IP 就很容易了,直接寫個腳本逐行讀取 cn.zone 文件并加入到 iptables 中:
#!/bin/bash #?Block?traffic?from?a?specific?country #?written?by?vpsee.comCOUNTRY="us" IPTABLES=/sbin/iptables EGREP=/bin/egrepif?[?"$(id?-u)"?!=?"0"?];?thenecho?"you?must?be?root"?1>&2exit?1 firesetrules()?{ $IPTABLES?-F $IPTABLES?-t?nat?-F $IPTABLES?-t?mangle?-F $IPTABLES?-X }resetrulesfor?c?in?$COUNTRY docountry_file=$c.zoneIPS=$($EGREP?-v?"^#|^$"?$country_file)for?ip?in?$IPSdoecho?"blocking?$ip"$IPTABLES?-A?INPUT?-s?$ip?-j?DROPdone doneexit?0把請求過多的IP記錄下來。
174.127.94.* 199.27.128.* 199.27.133.*
運行下面這行命令,來查看誰的訪問量最高(需要服務器安裝tcpdump)
tcpdump?-i?eth0?-tnn?dst?port?80?-c?1000?|?awk?-F"."?'{print?$1"."$2"."$3"."$4}'?|?sort?|?uniq?-c?|?sort?-nr?|head?-20?tcpdump:?verbose?output?suppressed,?use?-v?or?-vv?for?full?protocol?decode listening?on?eth0,?link-type?EN10MB?(Ethernet),?capture?size?65535?bytes 1000?packets?captured 1000?packets?received?by?filter 0?packets?dropped?by?kernel 1420?IP?174.7.7.*本文轉自 liang3391 51CTO博客,原文鏈接:http://blog.51cto.com/liang3391/1427328
總結
- 上一篇: 央行连续第四个月增持黄金,释放什么信号?
- 下一篇: 特朗普关税害苦美股,鲍威尔安抚“救市”?