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 蝺賊啣箔蒂脰摨:銴鋆賭誨蝣 箸憭交貊 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
銴鋆賭誨蝣
% G q/ a) V# ]8 d. U" h隞乩寞曉唬皞 ip 敺, 靘憒 ip x.x.x.x, 臭誑 iptables 餅餅* W5 d7 t3 `% M ?' U- T2 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
銴鋆賭誨蝣 隞乩:9 D( O: p$ _& i& ?. P G
https://www.phpini.com/linux/linux-netstat-detect-ddos+ F% Y* d; O" H6 Y5 ?
https://www.phpini.com/linux/count-ip-connections7 T' P5 u" O( J3 R
https://www.phpini.com/linux/netstat-check-connections
1 G( u( T0 ^3 } b2 B=================================================) _ H- [( y5 E8 H
血嚗5 i/ H0 o m/ j T7 @
亥岷芯port鋡怠芯函撘雿剁
! J# o5 d. ]6 Q$ \1.)- netstat -tulpn | grep LISTEN
銴鋆賭誨蝣 2.)- lsof -i -P -n | grep LISTEN
銴鋆賭誨蝣 3.)- sudo nmap -sT -O localhost
銴鋆賭誨蝣 =================================================/ y1 u! i# S( m: x
亥岷port雿函backlogbacklog閰脣憭改 嚗 https://cloud.tencent.com/developer/article/1644836+ @7 p) N. G% D6 q' z
|
|