1、命令安装
yum install ipset
yum install iptables
2、通过ipset创建黑白名单
ipset create whitelist hash:net
ipset create blacklist hash:net
3、通过iptables开启黑白名单
> 开启黑白名单
iptables -P INPUT DROP
iptables -A INPUT -m set --match-set whitelist src -j ACCEPT
> 开启黑名单
iptables -P INPUT ACCEPT
iptables -A INPUT -m set --match-set blacklist src -j DROP