Linux下防范小型cc攻击

网文参考:https://blog.csdn.net/xb12369/article/details/49472321/

自己整理

一、Linux下防范小型CC攻击

(一)查看

1、查看所有80端口的连接数

netstat -ant |grep -i "80" |wc -l

2、对连接的IP按照数量进行排序

netstat -anp | grep 'tcp|udp' |awk '{print $5}' | cut -d: -f1 |sort | uniq -c |sort -n

3、查找较多time_wait连接

netstat -n|grep TIME_WAIT|awk '{print $5}'|sort|uniq -c|sort -rn|head -n20

4、查找较多的SYN连接

netstat -an | grep SYN | awk '{print $5}' | awk -F: '{print $1}' | sort | uniq -c | sort -nr | more

(二)措施:用iptables封ip

1、封单个IP的命令是:

iptables -I INPUT -s 211.1.0.0 -j DROP

2、封IP段的命令是:

iptables -I INPUT -s 211.1.0.0/16 -j DROP

二、Linux下防范大型CC攻击

1、运营商层面。如:流量镜像中分析恶意流量,进行清洗

2、大型DDos网关层面。如:网关设备上进行流量清洗

原文地址:https://www.cnblogs.com/andy9468/p/13538786.html