每日彙整: 2020/01/01

使用 ipset 及 firewalld 做黑名單管理

一、先建立黑名單:

ipset create blacklist hash:ip hashsize 4096

二、加入 IP 位址:

ipset add blacklist 192.168.0.5 
ipset add blacklist 192.168.0.100
ipset add blacklist 192.168.0.220

三、建立 firewalld 規則:

firewall-cmd --direct --add-rule ipv4 filter INPUT 0 -m set --match-set blacklist src -j DROP