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

阅读 158

2022-10-13


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

精彩评论(0)

0 0 举报