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
銴鋆賭誨蝣 % m. Y' C. w# ~+ a
隞乩寞曉唬皞 ip 敺, 靘憒 ip x.x.x.x, 臭誑 iptables 餅餅
' |+ M/ H* L% a3 a! Q$ a撠 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
銴鋆賭誨蝣 隞乩:
' @3 [) b7 u5 |$ Thttps://www.phpini.com/linux/linux-netstat-detect-ddos" W+ K8 k0 n5 ]/ A2 G$ O( M2 h
https://www.phpini.com/linux/count-ip-connections3 ]) h1 P* n/ t6 y6 D }# }3 t
https://www.phpini.com/linux/netstat-check-connections
/ k7 Z" h; L5 F. `7 n9 g) m=================================================2 Y) }/ G9 P* Q# D) T5 S
血嚗
) v2 @( C! i+ A' S+ I亥岷芯port鋡怠芯函撘雿剁& f4 B! A( G P$ p8 P, q1 t4 |/ f7 {
1.)- netstat -tulpn | grep LISTEN
銴鋆賭誨蝣 2.)- lsof -i -P -n | grep LISTEN
銴鋆賭誨蝣 3.)- sudo nmap -sT -O localhost
銴鋆賭誨蝣 =================================================
* {: @0 x: i% U, v* V4 a8 z亥岷port雿函backlogbacklog閰脣憭改 嚗 https://cloud.tencent.com/developer/article/16448360 M" ]' {1 W4 c. {6 t
|
|