SagerNet / sing-box

The universal proxy platform
https://sing-box.sagernet.org/
Other
15.38k stars 1.89k forks source link

如何理解 tun 模式的 dns 处理? #1866

Closed qazwsdc closed 1 week ago

qazwsdc commented 1 week ago

以下为 sing-box 文档给出的配置: { "dns": { "servers": [ { "tag": "google", "address": "tls://8.8.8.8" }, { "tag": "local", "address": "223.5.5.5", "detour": "direct" } ], "rules": [ { "outbound": "any", "server": "local" } ], "strategy": "ipv4_only" }, "inbounds": [ { "type": "tun", "inet4_address": "172.19.0.1/30", "auto_route": true, "strict_route": false } ], "outbounds": [ // ... { "type": "direct", "tag": "direct" }, { "type": "dns", "tag": "dns-out" } ], "route": { "rules": [ { "protocol": "dns", "outbound": "dns-out" }, { "geoip": [ "private" ], "outbound": "direct" } ], "auto_detect_interface": true } }

根据 rule 规则,所有的 dns 似乎都指向 local,那 dns 请求是如何经过代理的?这个配置是否存在 dns 泄露?

bulesky89857 commented 1 week ago

这只是一个简单示例,不要用这个