??Linux????β?CC??????
???????????? ???????[ 2013/5/14 10:09:18 ] ????????
????????CC??????CC?????????????????????????????????????????????????????????????????????????????ж???CC?????????????????????ЩLinux???ж?CC?????????
??????????80??????????
????netstat -nat|grep -i "80"|wc -l
???????????IP??????????????????
????netstat -anp | grep 'tcp|udp' | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n
????netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n
????netstat -ntu | awk '{print $5}' | egrep -o "[0-9]{1??3}.[0-9]{1??3}.[0-9]{1??3}.[0-9]{1??3}" | sort | uniq -c | sort -nr
??????TCP??????
????netstat -nat |awk '{print $6}'|sort|uniq -c|sort -rn
????netstat -n | awk '/^tcp/ {print $NF}'|sort|uniq -c|sort -rn
????netstat -n | awk '/^tcp/ {++S[$NF]};END {for(a in S) print a?? S[a]}'
????netstat -n | awk '/^tcp/ {++state[$NF]}; END {for(key in state) print key??" "??state[key]}'
????netstat -n | awk '/^tcp/ {++arr[$NF]};END {for(k in arr) print k??" "??arr[k]}'
????netstat -ant | awk '{print $NF}' | grep -v '[a-z]' | sort | uniq -c
??????80????????????20??IP
????cat /www/web_logs/waitalone.cn_access.log|awk '{print $1}'|sort|uniq -c|sort -nr|head -100
????tail -n 10000 /www/web_logs/waitalone.cn_access.log|awk '{print $1}'|sort|uniq -c|sort -nr|head -100
????cat /www/web_logs/waitalone.cn_access.log|awk '{print $1}'|sort|uniq -c|sort -nr|head -100
????netstat -anlp|grep 80|grep tcp|awk '{print $5}'|awk -F: '{print $1}'|sort|uniq -c|sort -nr|head -n20
????netstat -ant |awk '/:80/{split($5??ip??":");++A[ip[1]]}END{for(i in A) print A??i}' |sort -rn|head -n20
??????tcpdump???80?????????????
????tcpdump -i eth0 -tnn dst port 80 -c 1000 | awk -F"." '{print $1"."$2"."$3"."$4}' | sort | uniq -c | sort -nr |head -20
??????????time_wait????
????netstat -n|grep TIME_WAIT|awk '{print $5}'|sort|uniq -c|sort -rn|head -n20
???????????SYN????
????netstat -an | grep SYN | awk '{print $5}' | awk -F: '{print $1}' | sort | uniq -c | sort -nr | more
????linux?????iptables??ip?ε??Щ????????
????????IP?????????
????iptables -I INPUT -s 211.1.0.0 -j DROP
??????IP?ε????????
????iptables -I INPUT -s 211.1.0.0/16 -j DROP
????iptables -I INPUT -s 211.2.0.0/16 -j DROP
????iptables -I INPUT -s 211.3.0.0/16 -j DROP
???????????ε????????
????iptables -I INPUT -s 211.0.0.0/8 -j DROP
?????????ε????????
????iptables -I INPUT -s 61.37.80.0/24 -j DROP
????iptables -I INPUT -s 61.37.81.0/24 -j DROP
?????????????????????е??????????????
????1?????????/etc/rc.local??
????2??iptables-save >/etc/sysconfig/iptables??????????iptables??????/etc/sysconfig/iptables?У??????iptables??????С?
????3??service iptables save ???????????iptables?????/etc/sysconfig/iptables?У??????iptables??????С?
??????????????????iptables???????network???????????????????
???????????
????iptables -D INPUT -s IP??? -j REJECT
????iptables -F ??????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11