IPset 操作
ipset 是 iptables 的协助工具,可以管理一组 IP 地址。
[TOC]
创建集合
# TYPENAME := method:datatype[,datatype[,datatype]]
# method := bitmap, hash, list
# dateatype := ip, net, mac, port, iface
ipset create SETNAME(自定义名称) TYPENAME [ CREATE-OPTIONS ]
# 添加一个叫做 "myset" 的 "net" 网络地址的 "hash" 集合
ipset create myset hash:net
# 添加一个叫做 "myset-ip" 的 "ip" 的 "hash" 集合
# 可添加 IP 段,但是实际通过 IP 的方式保存
ipset create myset-ip hash:ip添加地址
# 加入的 ADD-ENTRY 必须与创建 ipset 时指定的格式匹配
ipset add SETNAME ADD-ENTRY [ ADD-OPTIONS ]
# 添加一组 IP 地址
ipset add myset 1.1.1.0/24
# 添加一个 IP 地址
ipset add myset-ip 1.1.1.1使用集合
其他命令
删除记录
查询记录
导入导出
其他用法
取消匹配
匹配 ip:port
超时
Last updated
Was this helpful?