dstat -cd --disk-util -r
The command-line flags include
-c for CPU stats, -d for disk stats, --disk-util for disk utilization and -r for disk transactions (I/O requests) per second. You can read more about dstat here.IOPing
ATOP
-c for CPU stats, -d for disk stats, --disk-util for disk utilization and -r for disk transactions (I/O requests) per second. You can read more about dstat here.ipset create vader hash:ip
iptables -I INPUT -m set --match-set vader src -j DROP
ipset add vader 4.5.6.7
ipset add vader 1.2.3.4
ipset add vader ...
ipset list vader # 查看 vader 集合的内容
ipset create vader hash:ip
iptables -I INPUT -m set --match-set vader src -j DROP
iptables -I INPUT -m set ! --match-set yoda src -j DROP
netstat -ntu | tail -n +3 | awk '{print $5}' | sort | uniq -c | sort -nr
awk '{print $1}' /var/log/nginx/access.log | sort | uniq -c | sort -nr
ipset add vader 4.5.6.7

hash:ip,port就是 IP 地址和端口号共同作为 hash 的键。查看 ipset 的帮助文档可以看到它支持的所有类型。ipset create r2d2 hash:net
ipset add r2d2 1.2.3.0/24
ipset add r2d2 1.2.3.0/30 nomatch
ipset add r2d2 6.7.8.9
ipset test r2d2 1.2.3.2
hash:net 指定了可以往 r2d2 这个集合里添加 IP 段或 IP 地址。nomatch 的作用简单来说是把 1.2.3.0/30 从 1.2.3.0/24 这一范围相对更大的段里“剥离”了出来,也就是说执行完 ipset add r2d2 1.2.3.0/24 只后1.2.3.0/24 这一段 IP 是属于 r2d2 集合的,执行了 ipset add r2d2 1.2.3.0/30 nomatch 之后,1.2.3.0/24 里 1.2.3.0/30 这部分,就不属于 r2d2 集合了。执行 ipset test r2d2 1.2.3.2 就会得到结果 1.2.3.2 is NOT in set r2d2.ipset create c-3po hash:ip,port
ipset add c-3po 3.4.5.6,80
ipset add c-3po 5.6.7.8,udp:53
ipset add c-3po 1.2.3.4,80-86
ipset create obiwan hash:ip timeout 300
ipset add obiwan 1.2.3.4
ipset add obiwan 6.6.6.6 timeout 60
ipset list obiwan 可以看到这个集合里条目的 timeout 一直在随着时间变化,标志着它们在多少秒之后会被删除。-exit 这一选项。ipset -exist add obiwan 1.2.3.4 timeout 100
1.2.3.4 这一条数据的 timeout 值就变成了 100,如果这里设置 300,那么它的 timeout,也就是存活时间又重新变成 300。add 会收到报错。想要默认条目不会过期(自动删除),又需要添加某些条目时加上 timeout 参数,可以在创建集合时指定 timeout 为 0。ipset create luke hash:ip
ipset add luke 5.5.5.5 timeout 100
# 得到报错信息 kernel error received: Unknown error -1
ipset create yoda hash:ip,port hashsize 4096 maxelem 1000000
ipset add yoda 3.4.5.6,3306
ipset del yoda x.x.x.x # 从 yoda 集合中删除内容
ipset list yoda # 查看 yoda 集合内容
ipset list # 查看所有集合的内容
ipset flush yoda # 清空 yoda 集合
ipset flush # 清空所有集合
ipset destroy yoda # 销毁 yoda 集合
ipset destroy # 销毁所有集合
ipset save yoda # 输出 yoda 集合内容到标准输出
ipset save # 输出所有集合内容到标准输出
ipset restore # 根据输入内容恢复集合内容
hash:ip 或 hash:ip,port ,在添加条目时,可以填 IP 段,但是仍然是以单独一个个 IP 的方式来存。man upset 和 ipset —help 可以查到更多的内容,包括各种选项,支持的类型等等。Almost all Windows OS List: https://www.heidoc.net/php/myvsdump_details.php?id=P1521F62172Ax64Lcn Latest keys: https://bbs.kafan.cn/th...