Closed ninepass closed 8 months ago
dns_resolve不要用fakeip,用真实的dns server
@AmberisMyShiba 改成其他的也一样,比如我改成 223.5.5.5
TUN模式重定向所有穿过的流量,只需要把设备的IPv4和IPv6的网关填成sing-box就行,设备的dns随意设但不能设为singbox的IP,况且你的inbound里也没有提供dns查询服务,这就导致的设备的dns流量无法被singbox接收。
TUN模式重定向所有穿过的流量,只需要把设备的IPv4和IPv6的网关填成sing-box就行,设备的dns随意设但不能设为singbox的IP,况且你的inbound里也没有提供dns查询服务,这就导致的设备的dns流量无法被singbox接收。
请问下为啥不能将dns设置为singbox IP 我现在就遇到这种问题,下面的配置,终端设置dns为sing-box IP时候无法提供解析 将tun配置删除,只保留direct 53,可以正常解析
TUN模式重定向所有穿过的流量,只需要把设备的IPv4和IPv6的网关填成sing-box就行,设备的dns随意设但不能设为singbox的IP,况且你的inbound里也没有提供dns查询服务,这就导致的设备的dns流量无法被singbox接收。
请问下为啥不能将dns设置为singbox IP 我现在就遇到这种问题,下面的配置,终端设置dns为sing-box IP时候无法提供解析 将tun配置删除,只保留direct 53,可以正常解析
你把这段加到tun字段里
"inet4_route_address": [
"198.18.0.0/15",
"91.105.192.0/23",
"91.108.4.0/22",
"91.108.8.0/21",
"91.108.16.0/21",
"91.108.56.0/22",
"95.161.64.0/20",
"149.154.160.0/20",
"185.76.151.0/24"
],
TUN模式重定向所有穿过的流量,只需要把设备的IPv4和IPv6的网关填成sing-box就行,设备的dns随意设但不能设为singbox的IP,况且你的inbound里也没有提供dns查询服务,这就导致的设备的dns流量无法被singbox接收。
请问下为啥不能将dns设置为singbox IP 我现在就遇到这种问题,下面的配置,终端设置dns为sing-box IP时候无法提供解析 将tun配置删除,只保留direct 53,可以正常解析
你把这段加到tun字段里
"inet4_route_address": [ "198.18.0.0/15", "91.105.192.0/23", "91.108.4.0/22", "91.108.8.0/21", "91.108.16.0/21", "91.108.56.0/22", "95.161.64.0/20", "149.154.160.0/20", "185.76.151.0/24" ],
加上您提供的配置可以解析,且上网也正常。请问这是什么原因导致?
但是dns rules
最后兜底的final
不能设置为fakeip
,就会导致rules规则中没匹配到的最后走兜底会获取到真实IP,但又因为上面inet4_route_address
不包含真实IP,这种情况要怎么解决?
"dns": {
"servers": [
{
"tag": "dnsDirect",
"address": "https://223.5.5.5/dns-query",
"address_strategy": "ipv4_only",
"strategy": "ipv4_only",
"detour": "directOut"
},
{
"tag": "dnsProxy",
"address": "https://1.1.1.1/dns-query", // Cloudflare
"address_strategy": "ipv4_only",
"strategy": "ipv4_only",
"detour": "Selector",
"client_subnet": "1.0.1.0"
},
{
"tag": "FakeIP",
"address": "fakeip"
}
],
"fakeip": {
"enabled": true,
"inet4_range": "198.18.0.0/16"
},
"rules": [
{
"outbound": "any",
"server": "dnsDirect"
},
{
"rule_set": "geosite-geolocation-cn",
"server": "dnsDirect"
},
{
"domain_suffix": [
"google.com",
"github.com",
"youtube.com",
"openai.com"
],
"server": "FakeIP"
},
{
"rule_set": "geosite-geolocation-!cn",
"server": "FakeIP"
}
],
"final": "FakeIP",
"strategy": "ipv4_only" // prefer_ipv4 prefer_ipv6 ipv4_only ipv6_only
},
如上配置执行sing-box check
会有下面错误
FATAL[0000] parse route options: default DNS server cannot be fakeip
Operating system
Mac os
System version
10.15.7
Installation type
Original sing-box Command Line
If you are using a graphical client, please provide the version of the client.
No response
Version
Description
在mac上运行tun模式,如何将本机dns设为127.0.0.1 或者虚拟网卡地址 172.19.0.1 浏览器dns无法解析但其他软件可以访问
通过tun模式作为旁路由,将dns设为旁路由地址后,无法上网,只能设置成其他的如9.9.9.9
Reproduction
配置文件如下:
{ "log": { "level": "debug", "timestamp": true }, "dns": { "fakeip": { "enabled": true, "inet4_range": "198.18.0.0/15", "inet6_range": "fc00::/18" }, "servers": [ { "tag": "dns_proxy", "address": "h3://8.8.8.8/dns-query", "address_resolver": "dns_resolver", "strategy": "prefer_ipv4", "detour": "proxy-us" }, { "tag": "dns_local", "address": "https://223.5.5.5/dns-query", "strategy": "prefer_ipv4", "detour": "direct" }, { "tag": "dns_block", "address": "rcode://refused" }, { "tag": "dns_resolver", "address": "fakeip", "strategy": "ipv4_only", "detour": "direct" } ], "rules": [ { "outbound": [ "any" ], "server": "dns_local" }, { "domain":[ "www.cn.bing.com" ], "outbound": [ "direct" ], "server": "dns_local" }, { "domain":[ "www.youtube.com" ], "outbound": [ "proxy-us" ], "server": "dns_proxy" }, { "geoip": [ "cn" ], "outbound": [ "direct" ], "server": "dns_local", "disable_cache": false, "client_subnet": "127.0.0.1" }, { "outbound": [ "direct" ], "server": "dns_local", "disable_cache": false } ], "final": "dns_local", "strategy": "ipv4_only", "disable_cache": true, "disable_expire": false, "independent_cache": true }, "route": { "rules": [ { "port": 53, "outbound": "dns-out" }, { "protocol": "dns", "outbound": "dns-out" }, { "rule_set": "geosite-cn", "outbound": "direct" }, { "ip_is_private": true, "outbound": "direct" }, { "rule_set": "geoip-cn", "outbound": "direct" }, { "rule_set": "geoip-us", "rule_set_ipcidr_match_source": true, "outbound": "proxy-us" }, { "rule_set": "geosite-cn", "invert": true, "rule_set_ipcidr_match_source": true, "outbound": "proxy-us" }, { "rule_set": [ "geosite-category-ads-all" ], "outbound": "block" } ], "rule_set": [ { "tag": "geosite-cn", "type": "remote", "format": "binary", "url": "https://raw.githubusercontent.com/SagerNet/sing-geosite/rule-set/geosite-cn.srs", "download_detour": "proxy" }, { "tag": "geoip-cn", "type": "remote", "format": "binary", "url": "https://raw.githubusercontent.com/SagerNet/sing-geoip/rule-set/geoip-cn.srs", "download_detour": "proxy" }, { "tag": "geoip-us", "type": "remote", "format": "binary", "url": "https://raw.githubusercontent.com/SagerNet/sing-geoip/rule-set/geoip-us.srs", "download_detour": "proxy" }, { "tag": "geosite-category-ads-all", "type": "remote", "format": "binary", "url": "https://raw.githubusercontent.com/SagerNet/sing-geosite/rule-set/geosite-category-ads-all.srs", "download_detour": "direct" } ], "auto_detect_interface": true }, "experimental": { "cache_file": { "enabled": true } }, "inbounds": [ { "type": "mixed", "tag": "mixed-in", "listen": "::", "listen_port": 1085, "sniff": true, "sniff_override_destination": true }, { "type": "tun", "tag": "tun-in", "inet4_address": "172.19.0.1/30", "auto_route": true, "strict_route": false, "stack": "system", "sniff": true, "mtu": 9000, "sniff_override_destination": true } ], "outbounds": [ { "tag": "proxy", "type": "hysteria2", "server": "xxx", "server_port": 111, "up_mbps": 30, "down_mbps": 150, "password": "111", "network": "tcp", "tls": { "enabled": true, "server_name": "", "alpn": [ "h3" ] } }, { "tag": "proxy-us", "type": "hysteria2", "server": "xxx", "server_port": 123, "up_mbps": 30, "down_mbps": 150, "password": "111", "network": "tcp", "tls": { "enabled": true, "server_name": "", "alpn": [ "h3" ] } }, { "type": "direct", "tag": "direct" }, { "type": "block", "tag": "block" }, { "type": "dns", "tag": "dns-out" } ] }
Logs
Integrity requirements