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
銴鋆賭誨蝣 # ^# S5 Q) i( K! L7 j- C7 P
隞乩寞曉唬皞 ip 敺, 靘憒 ip x.x.x.x, 臭誑 iptables 餅餅
% B, B) B) a& ~$ W i( E撠 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
銴鋆賭誨蝣 隞乩:
. p' K3 t$ ]4 [# O/ k5 zhttps://www.phpini.com/linux/linux-netstat-detect-ddos
& L! R; P) Q& f2 N% V3 x# r3 ~5 a4 m8 xhttps://www.phpini.com/linux/count-ip-connections
/ t5 x/ F, \% H! Ahttps://www.phpini.com/linux/netstat-check-connections4 a; x" g" `, U
=================================================
5 C1 p$ b0 A9 w% a- I: Y$ P% @! q* M血嚗7 D6 Z1 C8 ], \" B& ], O7 j+ S
亥岷芯port鋡怠芯函撘雿剁
: H2 T* A2 x7 \& ] n8 b9 f1.)- netstat -tulpn | grep LISTEN
銴鋆賭誨蝣 2.)- lsof -i -P -n | grep LISTEN
銴鋆賭誨蝣 3.)- sudo nmap -sT -O localhost
銴鋆賭誨蝣 =================================================- ], a, i! J+ A2 q
亥岷port雿函backlogbacklog閰脣憭改 嚗 https://cloud.tencent.com/developer/article/16448369 ]; v( G7 C& X
|
|