使用带有防火墙的 Centos 8。我创建了 2 个 ipset,一个是永久的,一个是超时的:
firewall-cmd --permanent --new-ipset=blacklist_temp --type=hash:ip --option=timeout=86400
firewall-cmd --permanent --new-ipset=blacklist --type=hash:ip
firewall-cmd --reload
# ipset list
Name: blacklist_temp
Type: hash:ip
Revision: 4
Header: family inet hashsize 1024 maxelem 65536 timeout 86400
Size in memory: 120
References: 0
Number of entries: 0
Members:
Name: blacklist
Type: hash:ip
Revision: 4
Header: family inet hashsize 1024 maxelem 65536
Size in memory: 120
References: 0
Number of entries: 0
Members:
然后我将流量重定向到丢弃区:
firewall-cmd --zone=drop --add-source=ipset:blacklist_temp
firewall-cmd --zone=drop --add-source=ipset:blacklist
现在来谈谈问题:
# firewall-cmd --ipset=blacklist --add-entry=1.2.3.4
success
# firewall-cmd --ipset=blacklist_temp --add-entry=5.6.7.8
success
# firewall-cmd --ipset=blacklist --remove-entry=1.2.3.4
success
# firewall-cmd --ipset=blacklist_temp --remove-entry=5.6.7.8
Warning: NOT_ENABLED: '5.6.7.8' not in 'blacklist_temp'
success
我无法通过超时从 ipset 中删除 IP
# ipset list
Name: blacklist_temp
Type: hash:ip
Revision: 4
Header: family inet hashsize 1024 maxelem 65536 timeout 86400
Size in memory: 216
References: 0
Number of entries: 1
Members:
5.6.7.8 timeout 86376
Name: blacklist
Type: hash:ip
Revision: 4
Header: family inet hashsize 1024 maxelem 65536
Size in memory: 120
References: 0
Number of entries: 0
Members:
有没有办法使用防火墙命令删除?这是一个错误吗?