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

标签: 防火墙, 端口, tcp, iptables, mangle, comment, PREROUTING

相关文章推荐

添加新评论,含*的栏目为必填