Skip to content

Ipset

ipset常用命令

# 创建ip集
ipset create security hash:ip

# 查看ip集
ipset list

# 指定maxlen数量
ipset create banthis hash:net maxelem 1000000

# 添加/删除成员
ipset add security 172.16.64.202
ipset del security IP

# 将ipset规则保存到文件
ipset save blacklist -f blacklist.txt

# 从文件中导入规则
ipset restore -f blacklist.txt

# 删除ipset规则
ipset destroy blacklist