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
銴鋆賭誨蝣
+ S& n1 f3 _, A# Y% @7 H隞乩寞曉唬皞 ip 敺, 靘憒 ip x.x.x.x, 臭誑 iptables 餅餅0 u* H: s7 e, r: g6 m
撠 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
銴鋆賭誨蝣 隞乩:( G% O1 K- @ W0 v& X; l, z
https://www.phpini.com/linux/linux-netstat-detect-ddos( J: `' ~! T# u2 K3 F) @
https://www.phpini.com/linux/count-ip-connections8 q! Q& S6 }2 C2 @( h9 f
https://www.phpini.com/linux/netstat-check-connections, h7 l; ?/ Y' M; X
=================================================
5 b; \7 Z; X6 w3 z( [# D: e: u" |3 ^血嚗7 W/ i# }& K& y4 g5 @
亥岷芯port鋡怠芯函撘雿剁
8 D3 O8 U4 c8 H/ B1 S& E1.)- netstat -tulpn | grep LISTEN
銴鋆賭誨蝣 2.)- lsof -i -P -n | grep LISTEN
銴鋆賭誨蝣 3.)- sudo nmap -sT -O localhost
銴鋆賭誨蝣 =================================================% z, ^- w/ b1 W6 e
亥岷port雿函backlogbacklog閰脣憭改 嚗 https://cloud.tencent.com/developer/article/1644836
3 o4 u/ t: f% o* j |
|