New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
posts/iptables-and-container-networks/ #14
Comments
您好,有个疑惑希望向您请教下,容器的iptables规则是否独立于宿主机?我测试看了下LOG,容器中的流量并没有经过任何宿主机的iptables链,直到从docker0中出来。 |
@gethurb 是指在 iptables 里加了些 LOG 规则?Docker 实际上会在 nat 跟 filter 两个表中创建好几个自定义链。具体的 iptables 规则在这篇文章的第二节有给出来的。 |
您好!,-A POSTROUTING -s 172.18.0.2/32 -d 172.18.0.2/32 -p tcp -m tcp --dport 80 -j MASQUERADE 这条规则的作用是什么,什么情况下会被匹配到,一直没弄明白。 |
@YuJunping 这你可真问到我了,研究了一波发现我也没搞明白... 源地址与目标地址都是 172.18.0.2/32,说明是容器在请求它自己,为什么自己请求自己还要做 NAT(MASQUERADE) 呢??? 只要容器内的协议栈实现没毛病,请求它自己的 ip 地址根本不会走网桥,直接就走本地了,我抓包验证了请求容器自身 ip 时网桥上确实是没流量的。 查了下找到这里有遇到同样的问题 Docker Implementation of Published Ports, 这个老外表示: Please don't ask me under what scenario one might hit those rules... 感觉是很边缘的情况,如果你有什么发现可以留言沟通 emmm |
@YuJunping 这个特殊 iptables 规则的问题我之前在 0xffff 开了个帖子,有大佬给了些有用的信息,你可以看看: |
OK,谢谢!
原始邮件
发件人:"Ryan Yin"< ***@***.*** >;
发件时间:2023/3/15 16:56
收件人:"ryan4yin/thiscute.world"< ***@***.*** >;
抄送人:"YuJunping"< ***@***.*** >;"Mention"< ***@***.*** >;
主题:Re: [ryan4yin/thiscute.world] posts/iptables-and-container-networks/(Issue #14)
@YuJunping 这个特殊 iptables 规则的问题我之前在 0xffff 开了个帖子,有大佬给了些有用的信息,你可以看看:
https://0xffff.one/d/1450-docker-duan-kou-ying-she-shi-xian
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
iptables 及 docker 容器网络分析 - This Cute World
https://thiscute.world/posts/iptables-and-container-networks/
The text was updated successfully, but these errors were encountered: