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
銴鋆賭誨蝣
% L- V' P& O5 k5 ?隞乩寞曉唬皞 ip 敺, 靘憒 ip x.x.x.x, 臭誑 iptables 餅餅( g B7 `: q: 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
銴鋆賭誨蝣 隞乩:+ V3 t2 h% E; Z) Q; i/ l& ~8 O( y
https://www.phpini.com/linux/linux-netstat-detect-ddos
9 S/ ~1 f& v E" o3 fhttps://www.phpini.com/linux/count-ip-connections9 P+ M: w5 R5 _7 c
https://www.phpini.com/linux/netstat-check-connections5 J; m0 ^2 D7 H! i$ u2 k
=================================================
; I$ ^# g5 i# o$ [; @血嚗3 m/ f' @1 I7 [- I
亥岷芯port鋡怠芯函撘雿剁
7 b- x" s" w7 l1.)- netstat -tulpn | grep LISTEN
銴鋆賭誨蝣 2.)- lsof -i -P -n | grep LISTEN
銴鋆賭誨蝣 3.)- sudo nmap -sT -O localhost
銴鋆賭誨蝣 =================================================
0 n! g3 A( l$ h8 Y. h8 `$ o1 K亥岷port雿函backlogbacklog閰脣憭改 嚗 https://cloud.tencent.com/developer/article/1644836
8 h, A1 `3 n& ?; p8 u0 v |
|