屏蔽无关端口号
ipset create allowed_ips hash:net #创建ipset存储白名单
iptables -A INPUT -m set --match-set allowed_ips src -j ACCEPT #允许白名单内的所有ip访问
iptables -A INPUT -j REJECT #拒绝非白名单内的ip
ipset add allowed_ips 172.37.47.74 #添加ip
ipset add allowed_ips 172.37.47.75
ipset add allowed_ips 10.233.0.0/16
ipset add allowed_ips 10.234.0.0/16
......
##后续如果不需要了,则删除ipset和规则
iptables -D INPUT xxxx #先删规则
ipset destroy allowed_ips #删除ipset
ipset list allowed_ips #查看ip列表
ipset del allowed_ips x.x.x.x #删除某条ip
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
暂无评论内容