Linux防DDOS攻击一些方法总结linux操作系统电脑资料

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

Linux防DDOS攻击一些方法总结linux操作系统电脑资料在linux中要防ddos攻击我们最常用的方法就是安装DDoS
deflate来防止或减轻ddos攻击了,但还有使用其它方法,下面我来介绍一下,
DDoS deflate是一款的用来防御和减轻DDoS攻击的脚本。

它通过stat监测跟踪创立大量网络连接的IP地址,在检测到某个结点超
过预设的限制时,该程序会通过APF或IPTABLES制止或阻挡这些IP.
DDoS deflate :deflate.medialayer./
如何确认是否受到DDOS攻击?执行:
stat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n
执行后,将会显示效劳器上所有的每个IP多少个连接数。

以下是我自己用VPS测试的结果:
li88-99:~# stat -ntu | awk '{print $5}' | cut -d: -f1 |
sort | uniq -c | sort -n
1 114.226.9.132
1 174.129.237.157
1 58.60.118.142
1 Address
1 servers)
2 118.26.131.78
3 123.125.1.202
3 220.248.43.119
4 117.36.231.253
4 119.162.46.124
6 219.140.232.128
8 220.181.61.31
2311 67.215.242.196
每个IP几个、十几个或几十个连接数都还算比较正常,如果像上面成百上千肯定就不正常了。

1、安装DDoS deflate123
wget .ibase./scripts/ddos/install.sh //下载DDoS deflate
./install.sh //执行
2、配置DDoS deflate下面是DDoS deflate的默认配置位于
/usr/local/ddos/ddos.conf ,内容如下:
PROGDIR="/usr/local/ddos"
PROG="/usr/local/ddos/ddos.sh"
IGNOREIPLIST="/usr/local/ddos/ignore.ip.list" //IP地址白CRON="/etc/cron.d/ddos.cron" //定时执行程序
APF="/etc/apf/apf"
IPT="/sbin/iptables"
##### frequency in minutes for running the script
##### Caution: Every time this setting is changed, run the script. with --cron
##### option so that the new frequency takes effect
FREQ=1 //检查时间间隔,默认1分钟
##### How many connections define a bad IP? Indicate that below.
NOOFCONNECTIONS=150 //最大连接数,超过这个数IP就会被屏蔽,一般默认即可
##### APFBAN=1 (Make sure your APF version is atleast 0.96) ##### APFBAN=0 (Uses iptables for banning ips instead of APF)
APFBAN=1 //使用APF还是iptables,
##### KILL=0 (Bad IPs are'nt banned, good for interactive execution of script)
##### KILL=1 (Remended setting)
KILL=1 //是否屏蔽IP,默认即可
##### An email is sent to the following address when an IP is banned.
##### Blank would suppress sending of mails
EMAILTO="root" //当IP被屏蔽时给指定邮箱发送邮件,推荐使用,换成自己的邮箱即可
##### Number of seconds the banned ip should remain in blacklist.
BANPERIOD=600 //禁用IP时间,默认600秒,可根据情况调整
用户可根据给默认配置文件加上的注释提示内容,修改配置文件。

查看/usr/local/ddos/ddos.sh文件的第117行 (部分需要个性,当发现默认的无效时再修改此处)
stat -ntu | awk `{print $5}` | cut -d: -f1 | sort | uniq -c | sort -nr > $BADIPLIST
修改为以下代码即可!
stat -ntu | awk `{print $5}` | cut -d: -f1 | sed -n `/[0-9]/p` | sort | uniq -c | sort -nr > $BADIPLIST
喜欢折腾的可以用Web压力测试软件测试一下效果,相信DDoS deflate还是能给你的VPS或效劳器抵御一部分DDOS攻击,给你的网站更多的保护。

除了这种方法我们再推荐自己使用的一种防ddos攻击的方法
脚本
wget .ibase./scripts/ddos/install.sh
chmod +x install.sh
./install.sh
如需卸载那么
wget .ibase./scripts/ddos/uninstall.sh
chmod +x uninstall.sh
./uninstall.sh
然后就安装成功了.对于一般的ddos应该没问题了.。

相关文档
最新文档