iptables防火墙对容器暴露的端口做安全限制

1、对容器暴露的3306端口进行封堵:
iptables -t mangle -A PREROUTING -p tcp --dport 3306 -m comment --comment “iptables20210527” -j DROP
2、查看mangle表的规则: iptables防火墙对容器暴露的端口做安全限制3、删除mangle表中对应的PREROUTING链的规则:
iptables -t mangle -D PREROUTING 2
4、允许某个ip可以访问:
先同意:
iptables -t mangle -A PREROUTING -s 192.168.247.140 -p tcp -m comment --comment “iptables20210527” -j ACCEPT
在拒绝:
iptables -t mangle -A PREROUTING -p tcp --dport 3307 -m comment --comment “iptables20210527” -j DROP

上一篇:Linux骚操作之第三十话防火墙


下一篇:Linux防火墙