hysteria 用 tun 无法解析 dns
Welcome
- [X] Yes, I'm using the latest major release. Only such installations are supported.
- [X] Yes, I'm using the latest Golang release. Only such installations are supported.
- [X] Yes, I've searched similar issues on GitHub and didn't find any.
- [X] Yes, I've included all information below (version, FULL config, FULL log, etc).
Description of the problem
同样的配置把 hysteria 换成 shadowsocks 就能正常连接
Version of sing-box
.\sing-box-windows-amd64-v3.exe version
sing-box version 1.2-beta9-85380b6
Environment: go1.20.2 windows/amd64
Tags: with_quic,with_grpc,with_wireguard,with_ech,with_utls,with_reality_server,with_clash_api,with_v2ray_api,with_gvisor,with_conntrack Revision: 85380b6e47d854bee06f3568a84e294ad6d29631
CGO: disabled
Server and client configuration file
{
"log": {
# "disabled": true,
"level": "debug",
"timestamp": true
},
"dns": {
"servers": [
{
"tag": "z",
"address": "1.1.1.1"
},
{
"tag": "cndns",
"address": "https://223.5.5.5/dns-query",
"detour": "direct"
}
],
"rules": [
{
"geosite": [
"cn",
"category-games@cn"
],
"domain_keyword": [
"f5.si",
"mydns.jp",
"eu.org"
],
"server": "cndns"
}
]
},
"route": {
"auto_detect_interface": true,
"rules": [
{
"protocol": "dns",
"outbound": "dns-out"
},
{
"geosite": [
"category-ads-all"
],
"outbound": "block"
},
{
"domain": [
"gstatic.cn",
"googleapis.cn"
],
"geosite": [
"google@cn",
"tiktok"
],
"ip_cidr": [
"10.0.0.0/8",
"2603:c021:8002:2600::/64",
"172.24.0.0/24",
"172.26.0.0/24"
],
"outbound": "hy"
},
{
"geosite": [
"cn",
"category-games@cn"
],
"geoip": [
"cn"
],
"ip_cidr": [
"127.0.0.1",
"192.168.0.0/16",
"172.19.0.1/30",
"fd00::/8"
],
"outbound": "direct"
}
]
},
"inbounds": [
/* {
"type": "tun",
"tag": "tun-in",
"interface_name": "tun0",
"inet4_address": "172.19.0.1/30",
"inet6_address": "fdfe:dcba:9876::1/126",
"mtu": 9000,
"auto_route": true,
"strict_route": true,
"endpoint_independent_nat": true,
"stack": "gvisor",
"exclude_package": [
"com.android.captiveportallogin",
"com.tencent.tmgp.sgame"
],
"sniff": true,
"sniff_override_destination": true
},*/
{
"type": "mixed",
"tag": "mixed-in",
"tcp_fast_open": true,
"udp_fragment": false,
"sniff": true,
"sniff_override_destination": true,
"listen": "0.0.0.0",
"listen_port": 2080
}
],
"outbounds": [
{
"type": "hysteria",
"tag": "hy",
"server": "example",
"server_port": example,
"up_mbps": 50,
"down_mbps": 1024,
"auth_str": "example",
"tls": {
"enabled": true,
"server_name": "example",
"alpn": [
"h3"
]
}
},
{
"type": "direct",
"tag": "direct"
},
{
"type": "block",
"tag": "block"
},
{
"type": "dns",
"tag": "dns-out"
}
]
}
Server and client log file
+0800 2023-04-28 13:17:53 INFO outbound/hysteria[hy]: outbound packet connection to 1.1.1.1:53
+0800 2023-04-28 13:17:53 DEBUG dns: lookup domain example
+0800 2023-04-28 13:17:53 DEBUG dns: match[0] domain_keyword=[f5.si mydns.jp eu.org] geosite=[cn category-games@cn] => cndns
+0800 2023-04-28 13:17:53 DEBUG dns: lookup succeed for example: example
+0800 2023-04-28 13:17:53 ERROR [86845478] dns: exchange failed for api.msn.com. IN AAAA: dial udp example:example: operation was canceled
+0800 2023-04-28 13:17:53 INFO outbound/hysteria[hy]: outbound packet connection to 1.1.1.1:53
+0800 2023-04-28 13:17:53 DEBUG dns: lookup domain example
+0800 2023-04-28 13:17:53 DEBUG dns: match[0] domain_keyword=[f5.si mydns.jp eu.org] geosite=[cn category-games@cn] => cndns
+0800 2023-04-28 13:17:53 DEBUG dns: lookup succeed for example: example
+0800 2023-04-28 13:17:53 ERROR [2036907661] dns: exchange failed for arc.msn.com. IN A: dial udp example:example: operation was canceled
server
+0900 2023-04-28 14:34:46 INFO [1358660639 2m28s] outbound/direct[direct]: outbound packet connection
+0900 2023-04-28 14:34:46 DEBUG [1358660639 2m28s] inbound/hysteria[hysteria-in]: connection closed: process stream from 172.26.0.1:26
957: upload: use of closed network connection | download: raw-read udp [::]:54196: use of closed network connection
+0900 2023-04-28 14:34:46 INFO [1358660639 2m28s] inbound/hysteria[hysteria-in]: inbound packet connection to 1.1.1.1:53
+0900 2023-04-28 14:34:46 INFO [1358660639 2m28s] outbound/direct[direct]: outbound packet connection
+0900 2023-04-28 14:34:46 DEBUG [1358660639 2m28s] inbound/hysteria[hysteria-in]: connection closed: process stream from 172.26.0.1:26
957: upload: use of closed network connection | download: raw-read udp [::]:2481: use of closed network connection
+0900 2023-04-28 14:34:46 DEBUG [1358660639 2m28s] inbound/hysteria[hysteria-in]: connection closed: process stream from 172.26.0.1:26
957: upload: use of closed network connection | download: raw-read udp [::]:25111: use of closed network connection
+0900 2023-04-28 14:34:46 INFO [1358660639 2m28s] inbound/hysteria[hysteria-in]: inbound packet connection to 1.1.1.1:53
+0900 2023-04-28 14:34:46 INFO [1358660639 2m28s] outbound/direct[direct]: outbound packet connection
+0900 2023-04-28 14:34:47 INFO [1358660639 2m28s] inbound/hysteria[hysteria-in]: inbound packet connection to 1.1.1.1:53
+0900 2023-04-28 14:34:47 DEBUG [1358660639 2m28s] inbound/hysteria[hysteria-in]: connection closed: process stream from 172.26.0.1:26
957: upload: use of closed network connection | download: raw-read udp [::]:27868: use of closed network connection
+0900 2023-04-28 14:34:47 INFO [1358660639 2m28s] outbound/direct[direct]: outbound packet connection
尝试最新 commit。
我这边用hysteria协议也是一样的问题,dns用udp协议就是不行,换成tcp协议或者fakeip又可以
尝试最新 commit。 还是不得行
客户端
+0800 2023-05-25 22:17:25 DEBUG dns: lookup succeed for example.com: 1.5.8.6
+0800 2023-05-25 22:17:25 ERROR dns: exchange failed for www.msftconnecttest.com. IN A: dial udp 1.5.8.6:24523: operation was canceled
+0800 2023-05-25 22:17:25 INFO outbound/hysteria[hy-jp1]: outbound packet connection to 1.1.1.1:53
+0800 2023-05-25 22:17:25 DEBUG dns: lookup domain example.com
+0800 2023-05-25 22:17:25 DEBUG dns: match[0] domain_keyword=[ f5.si mydns.jp...] geosite=[cn category-games@cn] => cndns
+0800 2023-05-25 22:17:25 DEBUG dns: lookup succeed for example.com: 1.5.8.6
+0800 2023-05-25 22:17:25 ERROR dns: exchange failed for www.msftconnecttest.com. IN AAAA: dial udp 1.5.8.6:24523: operation was canceled
+0800 2023-05-25 22:17:25 INFO outbound/hysteria[hy-jp1]: outbound packet connection to 1.1.1.1:53
+0800 2023-05-25 22:17:25 DEBUG dns: lookup domain example.com
+0800 2023-05-25 22:17:25 DEBUG dns: match[0] domain_keyword=[ f5.si mydns.jp...] geosite=[cn category-games@cn] => cndns
+0800 2023-05-25 22:17:25 DEBUG dns: lookup succeed for example.com: 1.5.8.6
+0800 2023-05-25 22:17:25 ERROR dns: exchange failed for ts4.cn.mm.bing.net. IN AAAA: dial udp 1.5.8.6:24523: operation was canceled
+0800 2023-05-25 22:17:25 INFO outbound/hysteria[hy-jp1]: outbound packet connection to 1.1.1.1:53
+0800 2023-05-25 22:17:25 DEBUG dns: lookup domain example.com
+0800 2023-05-25 22:17:25 DEBUG dns: match[0] domain_keyword=[ f5.si mydns.jp...] geosite=[cn category-games@cn] => cndns
+0800 2023-05-25 22:17:25 DEBUG dns: lookup succeed for example.com: 1.5.8.6
+0800 2023-05-25 22:17:25 ERROR dns: exchange failed for ts4.cn.mm.bing.net. IN A: dial udp 1.5.8.6:24523: operation was canceled
服务端
+0900 2023-05-25 23:17:23 DEBUG [2065173254 58.1s] inbound/hysteria[hysteria-in]: connection closed: process stream from 172.
26.0.1:11158: upload: use of closed network connection | download: raw-read udp [::]:2218: use of closed network connection
+0900 2023-05-25 23:17:23 INFO [2065173254 58.1s] inbound/hysteria[hysteria-in]: inbound packet connection to 1.1.1.1:53
+0900 2023-05-25 23:17:23 INFO [2065173254 58.1s] outbound/direct[direct]: outbound packet connection
+0900 2023-05-25 23:17:23 INFO [2065173254 58.11s] inbound/hysteria[hysteria-in]: inbound packet connection to 1.1.1.1:53
+0900 2023-05-25 23:17:23 INFO [2065173254 58.11s] outbound/direct[direct]: outbound packet connection
+0900 2023-05-25 23:17:23 DEBUG [2065173254 58.11s] inbound/hysteria[hysteria-in]: connection closed: process stream from 172
.26.0.1:11158: upload: use of closed network connection | download: raw-read udp [::]:43426: use of closed network connection
+0900 2023-05-25 23:17:23 INFO [2065173254 58.21s] inbound/hysteria[hysteria-in]: inbound packet connection to 1.1.1.1:53
+0900 2023-05-25 23:17:23 DEBUG [2065173254 58.21s] inbound/hysteria[hysteria-in]: connection closed: process stream from 172
.26.0.1:11158: upload: use of closed network connection | download: raw-read udp [::]:2549: use of closed network connection
+0900 2023-05-25 23:17:23 INFO [2065173254 58.21s] outbound/direct[direct]: outbound packet connection
+0900 2023-05-25 23:17:23 DEBUG [2065173254 58.45s] inbound/hysteria[hysteria-in]: connection closed: process stream from 172
.26.0.1:11158: upload: use of closed network connection | download: raw-read udp [::]:19482: use of closed network connection
+0900 2023-05-25 23:17:23 INFO [2065173254 58.45s] inbound/hysteria[hysteria-in]: inbound packet connection to 1.1.1.1:53
+0900 2023-05-25 23:17:23 INFO [2065173254 58.45s] outbound/direct[direct]: outbound packet connection
+0900 2023-05-25 23:17:23 DEBUG [2065173254 58.55s] inbound/hysteria[hysteria-in]: connection closed: process stream from 172
.26.0.1:11158: upload: use of closed network connection | download: raw-read udp [::]:26674: use of closed network connection
+0900 2023-05-25 23:17:23 INFO [2065173254 58.55s] inbound/hysteria[hysteria-in]: inbound packet connection to 1.1.1.1:53
+0900 2023-05-25 23:17:23 INFO [2065173254 58.55s] outbound/direct[direct]: outbound packet connection
+0900 2023-05-25 23:17:24 DEBUG [2065173254 58.71s] inbound/hysteria[hysteria-in]: connection closed: process stream from 172
.26.0.1:11158: upload: use of closed network connection | download: raw-read udp [::]:52594: use of closed network connection
+0900 2023-05-25 23:17:24 DEBUG [2065173254 58.78s] inbound/hysteria[hysteria-in]: connection closed: process connection from
172.26.0.1:11158: Application error 0x0 (remote)
我一直使用的UDP,一切正常,这里是我的配置,只是没在里面凸显出UDP,但服务端设置的是UDP,希望对你有用 { "auth_str": "ikodsfhiUGoidsfsH", "disable_mtu_discovery": false, "down_mbps": 1250, "obfs": "", "server": "1.2.3.4", "server_port": 55555, "tls": { "alpn": [ "h3" ], "enabled": true, "insecure": true, "server_name": "域名" }, "up_mbps": 1250, "type": "hysteria", "tag": "us", "domain_strategy": "" },
我一直使用的UDP,一切正常,这里是我的配置,只是没在里面凸显出UDP,但服务端设置的是UDP,希望对你有用
测试移除 "network": "udp" 行后可正常使用 hysteria,但最新 commit 若退出前最后使用的节点是 hysteria,再次打开时会出现 kernel panic
panic: runtime error: invalid memory address or nil pointer dereference [signal 0xc0000005 code=0x0 addr=0x18 pc=0xd7f458]
goroutine 115 [running]: github.com/sagernet/quic-go.(*connMultiplexer).index(0x24170a92468?, {0x0, 0x0}) /home/username/go/pkg/mod/github.com/sagernet/[email protected]/multiplexer.go:45 +0x18 github.com/sagernet/quic-go.(*connMultiplexer).AddConn(0xc000014660, {0x24170a92468?, 0xc000292040?}) /home/username/go/pkg/mod/github.com/sagernet/[email protected]/multiplexer.go:52 +0xad github.com/sagernet/quic-go.(*Transport).init.func1() /home/username/go/pkg/mod/github.com/sagernet/[email protected]/transport.go:220 +0x362 sync.(*Once).doSlow(0x5f51dc?, 0x218c140?) /usr/local/go/src/sync/once.go:74 +0xbf sync.(*Once).Do(...) /usr/local/go/src/sync/once.go:65 github.com/sagernet/quic-go.(*Transport).init(0xc000d64000, 0x16?) /home/username/go/pkg/mod/github.com/sagernet/[email protected]/transport.go:186 +0x4d github.com/sagernet/quic-go.(*Transport).DialEarly(0xc000d64000, {0x1738690, 0xc00033e1e0}, {0x172de08?, 0xc0002fd6b0}, 0x0?, 0x0?) /home/username/go/pkg/mod/github.com/sagernet/[email protected]/transport.go:173 +0x9a github.com/sagernet/quic-go.DialEarly({0x1738690, 0xc00033e1e0}, {0x173ec00?, 0xc000292040?}, {0x172de08, 0xc0002fd6b0}, 0xc00033c820, 0x1738690?) /home/username/go/pkg/mod/github.com/sagernet/[email protected]/client.go:95 +0x10b github.com/sagernet/sing-dns/quic.CreateHTTP3Transport.NewHTTP3Transport.func1({0x1738690, 0xc00033e1e0}, {0xc0003560a0?, 0xc0006831f0?}, 0x3?, 0x7?) /home/username/go/pkg/mod/github.com/sagernet/[email protected]/quic/transport_http3.go:56 +0x151 github.com/sagernet/quic-go/http3.(*client).dial(0xc0003a6080, {0x1738690, 0xc00033e1e0}) /home/username/go/pkg/mod/github.com/sagernet/[email protected]/http3/client.go:122 +0x67 github.com/sagernet/quic-go/http3.(*client).RoundTripOpt.func1() /home/username/go/pkg/mod/github.com/sagernet/[email protected]/http3/client.go:262 +0x49 sync.(*Once).doSlow(0x1546e26?, 0x5?) /usr/local/go/src/sync/once.go:74 +0xbf sync.(*Once).Do(...) /usr/local/go/src/sync/once.go:65 github.com/sagernet/quic-go/http3.(*client).RoundTripOpt(0xc0003a6080, 0xc000708000, {0xb?, 0x0?}) /home/username/go/pkg/mod/github.com/sagernet/[email protected]/http3/client.go:261 +0xed github.com/sagernet/quic-go/http3.(*RoundTripper).RoundTripOpt(0x0?, 0xc000708000, {0x0?, 0x0?}) /home/username/go/pkg/mod/github.com/sagernet/[email protected]/http3/roundtrip.go:150 +0x50e github.com/sagernet/quic-go/http3.(*RoundTripper).RoundTrip(0x3a00000030?, 0x172a220?) /home/username/go/pkg/mod/github.com/sagernet/[email protected]/http3/roundtrip.go:164 +0x17 net/http.send(0xc000708000, {0x172a220, 0xc0001d80e0}, {0x5f5001?, 0x218c140?, 0x0?}) /usr/local/go/src/net/http/client.go:260 +0x606 net/http.(*Client).send(0xc00033e2a0, 0xc000708000, {0x241709a2810?, 0x24?, 0x0?}) /usr/local/go/src/net/http/client.go:181 +0x98 net/http.(*Client).do(0xc00033e2a0, 0xc000708000) /usr/local/go/src/net/http/client.go:724 +0x912 net/http.(*Client).Do(...) /usr/local/go/src/net/http/client.go:590 github.com/sagernet/sing-dns/quic.(*HTTP3Transport).Exchange(0xc000598e70, {0x1738690, 0xc00033e1e0}, 0x218a5a0?) /home/username/go/pkg/mod/github.com/sagernet/[email protected]/quic/transport_http3.go:95 +0x2c5 github.com/sagernet/sing-dns.(*Client).Exchange(0xc000598870, {0x17386c8, 0xc00037c0a0}, {0x173d320, 0xc000598e70}, 0xc000700090, 0x1) /home/username/go/pkg/mod/github.com/sagernet/[email protected]/client.go:115 +0x7d7 github.com/sagernet/sing-dns.(*Client).lookupToExchange(0xc000598870, {0x17386c8, 0xc00037c0a0}, {0x173d320, 0xc000598e70}, {0xc000356050, 0xa}, 0x1c, 0x3a?) /home/username/go/pkg/mod/github.com/sagernet/[email protected]/client.go:441 +0x289 github.com/sagernet/sing-dns.(*Client).Lookup.func2({0x17386c8?, 0xc00037c0a0?}) /home/username/go/pkg/mod/github.com/sagernet/[email protected]/client.go:197 +0x52 github.com/sagernet/sing/common/task.(*Group).RunContextList.func1() /home/username/go/pkg/mod/github.com/sagernet/[email protected]/common/task/task.go:68 +0x73 created by github.com/sagernet/sing/common/task.(*Group).RunContextList in goroutine 52 /home/username/go/pkg/mod/github.com/sagernet/[email protected]/common/task/task.go:67 +0x17c panic: runtime error: invalid memory address or nil pointer dereference [signal 0xc0000005 code=0x0 addr=0x0 pc=0x1137f6e]
goroutine 56 [running]: github.com/sagernet/quic-go/http3.(*client).RoundTripOpt(0xc0003a6080, 0xc000294200, {0xb?, 0x0?}) /home/username/go/pkg/mod/github.com/sagernet/[email protected]/http3/client.go:269 +0x10e github.com/sagernet/quic-go/http3.(*RoundTripper).RoundTripOpt(0x0?, 0xc000294200, {0x0?, 0x0?}) /home/username/go/pkg/mod/github.com/sagernet/[email protected]/http3/roundtrip.go:150 +0x50e github.com/sagernet/quic-go/http3.(*RoundTripper).RoundTrip(0x0?, 0x172a220?) /home/username/go/pkg/mod/github.com/sagernet/[email protected]/http3/roundtrip.go:164 +0x17 net/http.send(0xc000294200, {0x172a220, 0xc0001d80e0}, {0xc00051b801?, 0x5e8b08?, 0x0?}) /usr/local/go/src/net/http/client.go:260 +0x606 net/http.(*Client).send(0xc000286c30, 0xc000294200, {0x24170953c68?, 0x7ca3e8?, 0x0?}) /usr/local/go/src/net/http/client.go:181 +0x98 net/http.(*Client).do(0xc000286c30, 0xc000294200) /usr/local/go/src/net/http/client.go:724 +0x912 net/http.(*Client).Do(...) /usr/local/go/src/net/http/client.go:590 github.com/sagernet/sing-dns/quic.(*HTTP3Transport).Exchange(0xc000598e70, {0x1738690, 0xc000286b70}, 0x218a5a0?) /home/username/go/pkg/mod/github.com/sagernet/[email protected]/quic/transport_http3.go:95 +0x2c5 github.com/sagernet/sing-dns.(*Client).Exchange(0xc000598870, {0x17386c8, 0xc00028e500}, {0x173d320, 0xc000598e70}, 0xc00029ca20, 0x1) /home/username/go/pkg/mod/github.com/sagernet/[email protected]/client.go:115 +0x7d7 github.com/sagernet/sing-dns.(*Client).lookupToExchange(0xc000598870, {0x17386c8, 0xc00028e500}, {0x173d320, 0xc000598e70}, {0xc000340920, 0x9}, 0x1c, 0x0?) /home/username/go/pkg/mod/github.com/sagernet/[email protected]/client.go:441 +0x289 github.com/sagernet/sing-dns.(*Client).Lookup.func2({0x17386c8?, 0xc00028e500?}) /home/username/go/pkg/mod/github.com/sagernet/[email protected]/client.go:197 +0x52 github.com/sagernet/sing/common/task.(*Group).RunContextList.func1() /home/username/go/pkg/mod/github.com/sagernet/[email protected]/common/task/task.go:68 +0x73 created by github.com/sagernet/sing/common/task.(*Group).RunContextList in goroutine 68 /home/username/go/pkg/mod/github.com/sagernet/[email protected]/common/task/task.go:67 +0x17c
</details>
同样的问题,hy协议无法通过detour为远端的udp协议的dns来解析,这么几个版本都没有变化。
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 5 days
我这边遇到的问题是部分站点打不开,浏览器提示:DNS_PROBE_FINISHED_NXDOMAIN, 我的解决办法是将sing-box配置文件json中所有关于dns_block和category-ads-all的配置全删除后就可以了。可能是访问的站点属于广告平台,sing-box默认屏蔽了这些站点。
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 5 days
我的windows 10 系统打开TUN模式也是无法解析DNS,过不了一会儿就断网了。
+0800 2023-12-29 12:32:48 [31mERROR[0m dns: exchange failed for win1910.ipv6.microsoft.com. IN A: context deadline exceeded +0800 2023-12-29 12:32:58 [31mERROR[0m dns: exchange failed for chrome.cloudflare-dns.com. IN A: context deadline exceeded +0800 2023-12-29 12:33:08 [31mERROR[0m dns: exchange failed for dongtaiwang3.com. IN A: context deadline exceeded +0800 2023-12-29 12:33:18 [31mERROR[0m dns: exchange failed for dongtaiwang3.com. IN A: context deadline exceeded +0800 2023-12-29 12:33:28 [31mERROR[0m dns: exchange failed for www.msftconnecttest.com. IN A: context deadline exceeded +0800 2023-12-29 12:33:38 [31mERROR[0m dns: exchange failed for chrome.cloudflare-dns.com. IN A: context deadline exceeded +0800 2023-12-29 12:33:48 [31mERROR[0m dns: exchange failed for dongtaiwang3.com. IN A: context deadline exceeded +0800 2023-12-29 12:33:58 [31mERROR[0m dns: exchange failed for dongtaiwang3.com. IN A: context deadline exceeded +0800 2023-12-29 12:34:08 [31mERROR[0m dns: exchange failed for www.msftconnecttest.com. IN A: context deadline exceeded +0800 2023-12-29 12:34:18 [31mERROR[0m dns: exchange failed for chrome.cloudflare-dns.com. IN A: context deadline exceeded +0800 2023-12-29 12:34:28 [31mERROR[0m dns: exchange failed for www.msftconnecttest.com. IN A: context deadline exceeded +0800 2023-12-29 12:34:38 [31mERROR[0m dns: exchange failed for chrome.cloudflare-dns.com. IN A: context deadline exceeded
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 5 days
同样的问题