防止DDOS策略

1:安装服务

yum install -y net-tools httpd -y 

2:搭建基本环境

systemctl stop firewalld
systemctl start httpd
echo "hello world" >> /var/www/html/index.html
netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c 
| sort -n

3:模拟攻击

ab -n 1000 -c http://192.168.128.100/index.html

查看数据

netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n

在这里插入图片描述

4:安装DDoS deflate

wget http://www.inetbase.com/scripts/ddos/install.sh	#下载安装脚本
chmod a+x install.sh		#添加执行权限
./install.sh			#执行脚本

在这里插入图片描述
出现下面的界面就安装完成了,按q退出
在这里插入图片描述

5:配置文件介绍

vim /usr/local/ddos/ddos.conf 

内容详细介绍

##### Paths of the script and other files
PROGDIR="/usr/local/ddos"
PROG="/usr/local/ddos/ddos.sh"		#脚本
IGNORE_IP_LIST="/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		#自动检查时间间隔,单位分钟

##### How many connections define a bad IP? Indicate that below.
NO_OF_CONNECTIONS=150		#最大连接数,超过自动屏蔽IP

##### APF_BAN=1 (Make sure your APF version is atleast 0.96)
##### APF_BAN=0 (Uses iptables for banning ips instead of APF)
APF_BAN=1

##### KILL=0 (Bad IPs are'nt banned, good for interactive execution of script)
##### KILL=1 (Recommended setting)
KILL=1

##### An email is sent to the following address when an IP is banned.
##### Blank would suppress sending of mails
EMAIL_TO="root"		#有ip被屏蔽时,自动发告警邮件

##### Number of seconds the banned ip should remain in blacklist.
BAN_PERIOD=600		#禁用ip时间,默认600秒

安装后,不需要手动启动,它创建了crontab计划,每1分钟自动启动

6:查看被禁止的ip名单

iptables -L -n

7:服务操作

手动禁止 ip

iptables -A INPUT -s 192.168.100.202 -j DROP

查看禁止 ip

iptables -nvL

解除禁止 ip

iptables -D INPUT -s 192.168.100.202 -j DROP

7:卸载DDoS deflate服务

wget http://www.inetbase.com/scripts/ddos/uninstall.ddos
chmod a+x uninstall.ddos
./uninstall.ddos
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

starry-sea

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值