当前位置: 首页 > 工具软件 > ipset > 使用案例 >

【网络安全】通过iptables和ipset完成服务器防火墙黑名单和白名单功能

鲜于玮
2023-12-01

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

参考链接:ipset命令的介绍与使用:Centos7 ipset命令介绍及使用 - 人艰不拆_zmc - 博客园

 类似资料: