系统相关
首页 > 系统相关> > iptables防火墙对容器暴露的端口做安全限制

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

作者:互联网

1、对容器暴露的3306端口进行封堵:
iptables -t mangle -A PREROUTING -p tcp --dport 3306 -m comment --comment “iptables20210527” -j DROP
2、查看mangle表的规则: 在这里插入图片描述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

标签:iptables,comment,--,端口,防火墙,tcp,PREROUTING,mangle
来源: https://blog.csdn.net/qq_44397993/article/details/117332958