tcpdump -i eth0 -n -c 1000 | awk '{print $3}' | sort | uniq -c | sort -nr
分析源IP频率,异常高频率可能是攻击。
iftop -i eth0
实时查看带宽使用,突增的入站流量可能为DDoS。
netstat -anp | grep 'tcp\|udp' | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n
异常高的TCP/UDP连接数需警惕。
grep "HTTP/1.1\" 5" /var/log/nginx/access.log | awk '{print $1}' | sort | uniq -c | sort -nr
高频错误请求可能来自攻击。
netstat -n -p TCP | grep SYN_RECV | wc -l
SYN_RECV状态过多可能为SYN攻击。