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
銴鋆賭誨蝣 # J' V9 o3 y. }& H H- H% z
隞乩寞曉唬皞 ip 敺, 靘憒 ip x.x.x.x, 臭誑 iptables 餅餅$ m% e2 @# m! ]5 A! J
撠 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
銴鋆賭誨蝣 隞乩:
9 N- K1 q7 t' l9 {; Ohttps://www.phpini.com/linux/linux-netstat-detect-ddos: H. K: a n: b7 m L5 ^# P0 `" K, Z2 ?
https://www.phpini.com/linux/count-ip-connections7 F! a/ _/ m) i. n8 ~
https://www.phpini.com/linux/netstat-check-connections
% G: m7 \4 a5 ~, S' [+ x9 y$ j=================================================
8 a0 i8 }( q3 a! ]血嚗9 u' r, ^* y' r0 v3 c8 u4 V& I7 a; Z
亥岷芯port鋡怠芯函撘雿剁
2 h, z, B! N3 X2 `' I+ V- Z1.)- netstat -tulpn | grep LISTEN
銴鋆賭誨蝣 2.)- lsof -i -P -n | grep LISTEN
銴鋆賭誨蝣 3.)- sudo nmap -sT -O localhost
銴鋆賭誨蝣 =================================================
" l9 f6 O- g8 ?2 F. Z$ o* c+ ^亥岷port雿函backlogbacklog閰脣憭改 嚗 https://cloud.tencent.com/developer/article/1644836
( k4 O- Y: Q7 y8 [" h% v |
|