awk, cut, sort, uniq 隞, 臭誑啣箸 ip 蝺賊, 銝衣券蝺賊摨勗撠, 隞乩撠 TCP ESTABLISHED 蝺瑼X:- netstat -an|grep ESTABLISHED|awk '/^tcp/ {print $5}'|awk -F: '{print $1}'|sort|uniq -c|sort -nr|more
銴鋆賭誨蝣 撠 port 80 蝺, 撠瘥 ip 蝺賊啣箔蒂脰摨:- netstat -ntu | grep :80 | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -nr|more
銴鋆賭誨蝣 箸憭交貊 10 IP 園交賂嗡葉 :80 舫亙嚗舀寞唾瑼X亦- netstat -atnp -A inet | grep ":80" | awk -F " " '{print $5}' | awk -F ":" '{print $1}' | sort | uniq -c | sort -nr | head -10
銴鋆賭誨蝣 : w) g# Q2 r7 Q
隞乩寞曉唬皞 ip 敺, 靘憒 ip x.x.x.x, 臭誑 iptables 餅餅
' d% t7 z. o9 p( E- Q撠 IP- iptables -A INPUT -p all -s x.x.x.x/32 -j DROP
銴鋆賭誨蝣 閫文 IP- iptables -D INPUT -p all -s x.x.x.x/32 -j DROP
銴鋆賭誨蝣 隞乩:1 C' Q# Q8 R4 M; Z& S
https://www.phpini.com/linux/linux-netstat-detect-ddos
1 J7 @6 \ y$ t7 d) U( qhttps://www.phpini.com/linux/count-ip-connections
- d9 {9 N5 J" ~0 E& U- G3 Y4 Uhttps://www.phpini.com/linux/netstat-check-connections6 L2 u3 j' ~2 K1 p5 G; D
=================================================
& I; U6 v5 D* D2 ?/ M. `, Y血嚗
3 E% _7 }9 s0 n5 ]( R6 Z" Z亥岷芯port鋡怠芯函撘雿剁
/ R, |6 e# o6 {0 a! Z1.)- netstat -tulpn | grep LISTEN
銴鋆賭誨蝣 2.)- lsof -i -P -n | grep LISTEN
銴鋆賭誨蝣 3.)- sudo nmap -sT -O localhost
銴鋆賭誨蝣 =================================================0 Q% y0 Q$ o+ v" s1 y5 i+ D
亥岷port雿函backlogbacklog閰脣憭改 嚗 https://cloud.tencent.com/developer/article/16448367 ?# p; F) a3 n+ i+ j2 P
|
|