IrineSistiana / mosdns

一个 DNS 转发器
GNU General Public License v3.0
3.01k stars 340 forks source link

[Bug] forward_remote 谷歌域名一直失败,但是国内域名正常 #854

Open s949492225 opened 3 weeks ago

s949492225 commented 3 weeks ago

在提交之前,请确认

mosdns 版本

V5.3.3

操作系统

openwrt

Bug 描述和复现步骤

关闭openclash,直接使用mosdns查找dns,解析不出来dns,如果使用本机的53端口,那么一切正常,时区已检查是正确的, 换成smarddns正常,实在是不想用smartdns.

使用mosdns查询,超时

root@iStoreOS:~# nslookup www.google.com.hk 127.0.0.1:5335 Server: 127.0.0.1:5335 Address: 127.0.0.1:5335

;; connection timed out; no servers could be reached

使用本机正常 root@iStoreOS:~# ^C root@iStoreOS:~# nslookup www.google.com.hk Server: 127.0.0.1 Address: 127.0.0.1:53

Non-authoritative answer: Name: www.google.com.hk Address: 31.13.68.169

Non-authoritative answer:

使用的配置文件

config smartdns
        option server_name 'smartdns'
        option port '53'
        option tcp_server '1'
        option ipv6_server '1'
        option dualstack_ip_selection '1'
        option serve_expired '1'
        option resolve_local_hostnames '1'
        option auto_set_dnsmasq '1'
        option force_aaaa_soa '0'
        option force_https_soa '0'
        option rr_ttl_min '600'
        option seconddns_port '6553'
        option seconddns_tcp_server '1'
        option seconddns_no_speed_check '0'
        option seconddns_no_rule_addr '0'
        option seconddns_no_rule_nameserver '0'
        option seconddns_no_rule_ipset '0'
        option seconddns_no_rule_soa '0'
        option seconddns_no_dualstack_selection '0'
        option seconddns_no_cache '0'
        option coredump '0'
        option seconddns_server_group 'remote'
        option prefetch_domain '1'
        option seconddns_force_aaaa_soa '1'
        option enabled '1'
        option seconddns_enabled '1'
        option old_port '53'
        option old_enabled '1'
        option old_auto_set_dnsmasq '1'

config server
        option enabled '1'
        option name 'ali'
        option ip '223.5.5.5'
        option type 'tls'
        option server_group 'local'
        option blacklist_ip '0'
        option no_check_certificate '0'

config server
        option enabled '1'
        option name 'ali2'
        option ip '223.6.6.6'
        option type 'tls'
        option blacklist_ip '0'
        option no_check_certificate '0'
        option server_group 'local'

config server
        option enabled '1'
        option name 'google'
        option ip '8.8.8.8'
        option server_group 'remote'
        option blacklist_ip '0'
        option type 'tcp'

config server
        option enabled '1'
        option name 'google2'
        option ip '8.8.4.4'
        option server_group 'remote'
        option blacklist_ip '0'
        option type 'tcp'

mosdns 的 log 记录

2024-11-03 08:59:30 INFO    unpacking entry {"tag": "cn", "length": 10358, "file": "/var/mosdns/geoip_cn.txt"}
2024-11-03 08:59:30 INFO    unpacking entry {"tag": "cn", "length": 5232, "file": "/var/mosdns/geosite_cn.txt"}
2024-11-03 08:59:30 INFO    unpacking entry {"tag": "apple", "length": 1760, "file": "/var/mosdns/geosite_apple.txt"}
2024-11-03 08:59:30 INFO    unpacking entry {"tag": "geolocation-!cn", "length": 21745, "file": "/var/mosdns/geosite_geolocation-!cn.txt"}
2024-11-03 08:59:30 INFO    loading plugin  {"tag": "geosite_cn", "type": "domain_set"}
2024-11-03 08:59:30 INFO    starting api http server    {"addr": "0.0.0.0:9091"}
2024-11-03 08:59:30 INFO    loading plugin  {"tag": "geoip_cn", "type": "ip_set"}
2024-11-03 08:59:30 INFO    loading plugin  {"tag": "geosite_apple", "type": "domain_set"}
2024-11-03 08:59:30 INFO    loading plugin  {"tag": "geosite_no_cn", "type": "domain_set"}
2024-11-03 08:59:30 INFO    loading plugin  {"tag": "whitelist", "type": "domain_set"}
2024-11-03 08:59:30 INFO    loading plugin  {"tag": "blocklist", "type": "domain_set"}
2024-11-03 08:59:30 INFO    loading plugin  {"tag": "greylist", "type": "domain_set"}
2024-11-03 08:59:30 INFO    loading plugin  {"tag": "ddnslist", "type": "domain_set"}
2024-11-03 08:59:30 INFO    loading plugin  {"tag": "hosts", "type": "hosts"}
2024-11-03 08:59:30 INFO    loading plugin  {"tag": "redirect", "type": "redirect"}
2024-11-03 08:59:30 INFO    redirect    redirect rules loaded   {"length": 0}
2024-11-03 08:59:30 INFO    loading plugin  {"tag": "adlist", "type": "domain_set"}
2024-11-03 08:59:30 INFO    loading plugin  {"tag": "local_ptr", "type": "domain_set"}
2024-11-03 08:59:30 INFO    loading plugin  {"tag": "stream_media", "type": "domain_set"}
2024-11-03 08:59:30 INFO    loading plugin  {"tag": "cloudflare_cidr", "type": "ip_set"}
2024-11-03 08:59:30 INFO    loading plugin  {"tag": "forward_xinfeng_udp", "type": "forward"}
2024-11-03 08:59:30 INFO    loading plugin  {"tag": "forward_local", "type": "forward"}
2024-11-03 08:59:30 INFO    loading plugin  {"tag": "forward_remote", "type": "forward"}
2024-11-03 08:59:30 INFO    loading plugin  {"tag": "forward_remote_upstream", "type": "sequence"}
2024-11-03 08:59:30 INFO    loading plugin  {"tag": "forward_stream_media", "type": "forward"}
2024-11-03 08:59:30 INFO    loading plugin  {"tag": "forward_stream_media_upstream", "type": "sequence"}
2024-11-03 08:59:30 INFO    loading plugin  {"tag": "modify_ttl", "type": "sequence"}
2024-11-03 08:59:30 INFO    loading plugin  {"tag": "modify_ddns_ttl", "type": "sequence"}
2024-11-03 08:59:30 INFO    loading plugin  {"tag": "has_resp_sequence", "type": "sequence"}
2024-11-03 08:59:30 INFO    loading plugin  {"tag": "query_is_non_local_ip", "type": "sequence"}
2024-11-03 08:59:30 INFO    loading plugin  {"tag": "fallback", "type": "fallback"}
2024-11-03 08:59:30 INFO    loading plugin  {"tag": "apple_domain_fallback", "type": "fallback"}
2024-11-03 08:59:30 INFO    loading plugin  {"tag": "query_is_apple_domain", "type": "sequence"}
2024-11-03 08:59:30 INFO    loading plugin  {"tag": "query_is_ddns_domain", "type": "sequence"}
2024-11-03 08:59:30 INFO    loading plugin  {"tag": "query_is_local_domain", "type": "sequence"}
2024-11-03 08:59:30 INFO    loading plugin  {"tag": "query_is_no_local_domain", "type": "sequence"}
2024-11-03 08:59:30 INFO    loading plugin  {"tag": "query_is_whitelist_domain", "type": "sequence"}
2024-11-03 08:59:30 INFO    loading plugin  {"tag": "query_is_greylist_domain", "type": "sequence"}
2024-11-03 08:59:30 INFO    loading plugin  {"tag": "query_is_reject_domain", "type": "sequence"}
2024-11-03 08:59:30 INFO    loading plugin  {"tag": "query_is_stream_media_domain", "type": "sequence"}
2024-11-03 08:59:30 INFO    loading plugin  {"tag": "main_sequence", "type": "sequence"}
2024-11-03 08:59:30 INFO    loading plugin  {"tag": "udp_server", "type": "udp_server"}
2024-11-03 08:59:30 INFO    udp_server  udp server started  {"addr": "[::]:5335"}
2024-11-03 08:59:30 INFO    loading plugin  {"tag": "tcp_server", "type": "tcp_server"}
2024-11-03 08:59:30 INFO    tcp_server  tcp server started  {"addr": "[::]:5335", "tls": false}
2024-11-03 08:59:30 INFO    all plugins are loaded
2024-11-03 09:04:00 WARN    forward_remote_upstream.r0  reference query routine err {"query": {"uqid": 2, "client": "::ffff:127.0.0.1", "qname": "www.google.com.hk.", "qtype": 1, "qclass": 1, "elapsed": "5.001890037s"}, "error": "context deadline exceeded"}
2024-11-03 09:04:00 WARN    udp_server  entry err   {"query": {"uqid": 2, "client": "::ffff:127.0.0.1", "qname": "www.google.com.hk.", "qtype": 28, "qclass": 1, "elapsed": "5.001890091s"}, "error": "context deadline exceeded"}
2024-11-03 09:04:00 WARN    udp_server  entry err   {"query": {"uqid": 1, "client": "::ffff:127.0.0.1", "qname": "www.google.com.hk.", "qtype": 1, "qclass": 1, "elapsed": "5.002018338s"}, "error": "context deadline exceeded"}
2024-11-03 09:04:00 WARN    forward_remote  upstream error  {"uqid": 2, "qname": "www.google.com.hk.", "qclass": 1, "qtype": 1, "upstream": "tls://8.8.8.8", "error": "context deadline exceeded"}
2024-11-03 09:04:00 WARN    forward_remote  upstream error  {"uqid": 1, "qname": "www.google.com.hk.", "qclass": 1, "qtype": 1, "upstream": "tls://8.8.8.8", "error": "context deadline exceeded"}
2024-11-03 09:04:00 WARN    forward_remote  upstream error  {"uqid": 1, "qname": "www.google.com.hk.", "qclass": 1, "qtype": 1, "upstream": "tls://8.8.8.8", "error": "context deadline exceeded"}
2024-11-03 09:04:00 WARN    forward_remote  upstream error  {"uqid": 2, "qname": "www.google.com.hk.", "qclass": 1, "qtype": 28, "upstream": "tls://8.8.8.8", "error": "context deadline exceeded"}
2024-11-03 09:04:00 WARN    forward_remote  upstream error  {"uqid": 2, "qname": "www.google.com.hk.", "qclass": 1, "qtype": 28, "upstream": "tls://8.8.8.8", "error": "context deadline exceeded"}
2024-11-03 09:04:00 WARN    forward_remote  upstream error  {"uqid": 2, "qname": "www.google.com.hk.", "qclass": 1, "qtype": 1, "upstream": "tls://8.8.8.8", "error": "context deadline exceeded"}
2024-11-03 09:04:02 WARN    forward_remote  upstream error  {"uqid": 4, "qname": "www.google.com.hk.", "qclass": 1, "qtype": 1, "upstream": "tls://8.8.8.8", "error": "context deadline exceeded"}
2024-11-03 09:04:02 WARN    forward_remote_upstream.r0  reference query routine err {"query": {"uqid": 3, "client": "::ffff:127.0.0.1", "qname": "www.google.com.hk.", "qtype": 1, "qclass": 1, "elapsed": "5.001823718s"}, "error": "context deadline exceeded"}
2024-11-03 09:04:02 WARN    forward_remote  upstream error  {"uqid": 4, "qname": "www.google.com.hk.", "qclass": 1, "qtype": 1, "upstream": "tls://8.8.8.8", "error": "context deadline exceeded"}
2024-11-03 09:04:02 WARN    forward_remote  upstream error  {"uqid": 3, "qname": "www.google.com.hk.", "qclass": 1, "qtype": 1, "upstream": "tls://8.8.8.8", "error": "context deadline exceeded"}
2024-11-03 09:04:02 WARN    forward_remote  upstream error  {"uqid": 3, "qname": "www.google.com.hk.", "qclass": 1, "qtype": 28, "upstream": "tls://8.8.8.8", "error": "context deadline exceeded"}
2024-11-03 09:04:02 WARN    udp_server  entry err   {"query": {"uqid": 3, "client": "::ffff:127.0.0.1", "qname": "www.google.com.hk.", "qtype": 28, "qclass": 1, "elapsed": "5.001869438s"}, "error": "context deadline exceeded"}
2024-11-03 09:04:02 WARN    udp_server  entry err   {"query": {"uqid": 4, "client": "::ffff:127.0.0.1", "qname": "www.google.com.hk.", "qtype": 1, "qclass": 1, "elapsed": "5.001887189s"}, "error": "all upstream servers failed"}
2024-11-03 09:04:02 WARN    forward_remote  upstream error  {"uqid": 3, "qname": "www.google.com.hk.", "qclass": 1, "qtype": 1, "upstream": "tls://8.8.8.8", "error": "context deadline exceeded"}
2024-11-03 09:04:02 WARN    forward_remote  upstream error  {"uqid": 3, "qname": "www.google.com.hk.", "qclass": 1, "qtype": 28, "upstream": "tls://8.8.8.8", "error": "context deadline exceeded"}
2024-11-03 09:04:05 WARN    forward_remote_upstream.r0  reference query routine err {"query": {"uqid": 5, "client": "::ffff:127.0.0.1", "qname": "www.google.com.hk.", "qtype": 1, "qclass": 1, "elapsed": "5.001083862s"}, "error": "context deadline exceeded"}
2024-11-03 09:04:05 WARN    forward_remote  upstream error  {"uqid": 5, "qname": "www.google.com.hk.", "qclass": 1, "qtype": 1, "upstream": "tls://8.8.8.8", "error": "context deadline exceeded"}
2024-11-03 09:04:05 WARN    forward_remote  upstream error  {"uqid": 5, "qname": "www.google.com.hk.", "qclass": 1, "qtype": 1, "upstream": "tls://8.8.8.8", "error": "context deadline exceeded"}
2024-11-03 09:04:05 WARN    udp_server  entry err   {"query": {"uqid": 5, "client": "::ffff:127.0.0.1", "qname": "www.google.com.hk.", "qtype": 28, "qclass": 1, "elapsed": "5.001238075s"}, "error": "context deadline exceeded"}
2024-11-03 09:04:05 WARN    forward_remote  upstream error  {"uqid": 5, "qname": "www.google.com.hk.", "qclass": 1, "qtype": 28, "upstream": "tls://8.8.8.8", "error": "context deadline exceeded"}
2024-11-03 09:04:05 WARN    forward_remote  upstream error  {"uqid": 5, "qname": "www.google.com.hk.", "qclass": 1, "qtype": 28, "upstream": "tls://8.8.8.8", "error": "context deadline exceeded"}
s949492225 commented 3 weeks ago

求救,不知道什么问题,日志也看不出明显的问题

chaohua27 commented 3 weeks ago

正常,说白点就是解析那会网络不稳定造成的,至于为何不稳定,懂的都懂。总之,我也去观察了,出现这种情况的时候要么就是DNS回复超时了,要么就是我前面说的网络不稳定根本收不到回复所以超时了。只要不是一直报问题不大。

s949492225 commented 3 weeks ago

比较可惜的是,是从来就没有成功解析过,cn外的dns无法解析,不清楚是什么问题,日志我也看不出头绪

ZhongMoDao commented 1 week ago

正常,说白点就是解析那会网络不稳定造成的,至于为何不稳定,懂的都懂。总之,我也去观察了,出现这种情况的时候要么就是DNS回复超时了,要么就是我前面说的网络不稳定根本收不到回复所以超时了。只要不是一直报问题不大。

不是这么简单就解释的,换成了插件自己代理就没问题了。

zxzlf commented 1 week ago

建议换HTTP3,UDP443虽然会丢包,但不至于一个都发不出去