Skip to content
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

命中 Direct 的流量 NAT 类型改变 #95

Open
muink opened this issue Apr 13, 2024 · 2 comments
Open

命中 Direct 的流量 NAT 类型改变 #95

muink opened this issue Apr 13, 2024 · 2 comments
Labels
question Further information is requested

Comments

@muink
Copy link
Collaborator

muink commented Apr 13, 2024

问题发现

因为一直都是在路由器上用 natmap 打洞, 通过打洞出来的 tcp/udp 端口连回家里或访问开放的服务
最近一次远程回家, 要测试点东西. 就把 homeproxy 的 Bypass CN traffic 给关了. 结果远程连接直接就断了, 其他的服务也都挂了

初步检查

回家后检查是 keep-alive 服务器命中了 Direct 规则, (natmap 定期向 www.baidu.com 发送 HTTP keep-alive 报文来保活)
之前因为开启了 Bypass CN traffic 流量直接在防火墙就走直连了, 没有再走一次 sing-box, 打洞就成功了
仔细检查后发现只要是命中 Direct 规则的流量, 全部变成了 端口过滤型 NAT, 也难怪打洞会失败了

检查结果

这是没有开启 homeproxy 时候的 tcp/udp 检查结果
Snipaste_2024-04-13_20-01-30

这是开启 homeproxy 时候的 tcp/udp 检查结果
查了下这个文章STUN (RFC 3489) vs. STUN (RFC 5389/5780)
出站的 srcnat 应该正常的, 但入站的就被过滤掉了
Snipaste_2024-04-13_19-59-05

@muink
Copy link
Collaborator Author

muink commented Apr 16, 2024

似乎与 openclash 的问题很像 vernesong/OpenClash#2288

@1715173329 1715173329 added the question Further information is requested label Apr 22, 2024
@muink
Copy link
Collaborator Author

muink commented May 10, 2024

查出原因了 本机端口 3456 在经过 sing-box 后转换为了 ip_local_port_range 的 port, 绕过了 3456 的 input 规则, 但是网关又不是 Full cone NAT, 自然连接降级了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants