摘要: 1、不让某个ip访问本机的80端口: iptables -t filter -I INPUT -p tcp -s 192.168.222.163 --dport 80 -j DROP 2、实现把访问 10.0.0.8:80 的请求转到 172.16.1.17:80 iptables -t NAT -A PREROUTING -d 10.0.0.8:80 -p tcp -j DNAT --de... 阅读全文
posted @ 2017-10-12 16:39 BigZero 阅读(289) 评论(0) 推荐(0) 编辑
摘要: 求1-100自然数的和: 法一:for循环 #!/bin/bash # declare -i sum=0 for ((i=0;i" | awk "{print $NF}");do if [ "$state" == 'ESTABLISHED' ];then let estab++ elif [ "$state" == 'LISTEN' ];then let listen+... 阅读全文
posted @ 2017-10-12 16:10 BigZero 阅读(286) 评论(0) 推荐(0) 编辑
摘要: #!/bin/bash # cat << EOF cpu) show cpu information; mem) show memory information; disk) show disk information; quit) quit ############################################################# EOF read -p "E... 阅读全文
posted @ 2017-10-12 15:40 BigZero 阅读(232) 评论(0) 推荐(0) 编辑
摘要: #!/bin/bash #ping net='172.16.1' uphosts=0 downhosts=0 for i in {1..254};do ping -c 1 -w 1 ${net}.${i} &> /dev/null if [ $? -eq 0 ];then echo "${net}.${i} is up." let uphosts++ else ... 阅读全文
posted @ 2017-10-12 15:39 BigZero 阅读(386) 评论(0) 推荐(0) 编辑