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
銴鋆賭誨蝣 $ z& l6 q' P% Y G: w. f/ [' J# x
隞乩寞曉唬皞 ip 敺, 靘憒 ip x.x.x.x, 臭誑 iptables 餅餅8 P( T( f; ~. f: y9 Y# Y- k9 `
撠 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
銴鋆賭誨蝣 隞乩:1 ?; B3 y) r* Z+ j
https://www.phpini.com/linux/linux-netstat-detect-ddos/ {) f/ \8 x b [/ r3 @' Q# O. U
https://www.phpini.com/linux/count-ip-connections
! @# [: m& @% H6 c& P% uhttps://www.phpini.com/linux/netstat-check-connections$ a- U/ \4 [; V# F+ S3 S; b
=================================================, i4 @5 [+ a' f. Q- Z+ |: Q5 R5 J5 m7 o
血嚗+ u+ R' e4 f W; p! D
亥岷芯port鋡怠芯函撘雿剁
- w7 A" Q8 H8 J3 ^. i1.)- netstat -tulpn | grep LISTEN
銴鋆賭誨蝣 2.)- lsof -i -P -n | grep LISTEN
銴鋆賭誨蝣 3.)- sudo nmap -sT -O localhost
銴鋆賭誨蝣 =================================================0 y9 h D9 k( r6 F, }
亥岷port雿函backlogbacklog閰脣憭改 嚗 https://cloud.tencent.com/developer/article/1644836
2 f& R8 ~0 P6 B) c |
|