smartdns icon indicating copy to clipboard operation
smartdns copied to clipboard

dns查询无法返回v6地址,只返回v4地址

Open kevin-312 opened this issue 2 months ago • 10 comments

问题现象
简要描述问题出现的现象

运行环境

  1. 固件型号
    istoreos
  2. 运营商
    电信
  3. smartdns来源以及版本 docker,47最新版
  4. 涉及的配置(注意去除个人相关信息) #启动仪表盘 plugin smartdns_ui.so #设置仪表盘端口号 smartdns-ui.ip http://[::]:6080 #----基础配置----# bind [::]:53 -g cn bind-tcp [::]:53 -g cn

bind [::]:6053 -g zl bind-tcp [::]:6053 -g zl

bind :6553 -g gw -force-aaaa-soa bind-tcp :6553 -g gw -force-aaaa-soa

server-name smartdns prefetch-domain yes #测速模式 speed-check-mode ping,tcp:443,tcp:80,tcp:8080 #mosdns可以使用mdns查询本地dns mdns-lookup yes #ipv4、V6优选 #dualstack-ip-selection yes #dualstack-ip-selection-threshold 50 #日志等级off、fatal、error、warn、notice、info 或 debug log-level warn #日志大小 log-size 2M #日志归档数量 log-num 2 #日志权限 log-file-mode 644 #日志输出至控制台 audit-console yes log-file /etc/smartdns/logs/smartdns.log #审计 audit-enable yes audit-file /etc/smartdns/logs/smartdns-audit.log audit-size 2M audit-num 2 #允许返回客户最大ip数 max-reply-ip-num 2 #设置代理服务器 proxy-server socks5://192.168.68.15:1086 -name proxy #域名结果缓存个数 #cache-size 50000 #缓存路径 cache-file /etc/smartdns/smartdns.cache #是否持久化缓存 cache-persist yes #域名结果 TTL rr-ttl 600 rr-ttl-min 60 rr-ttl-max 600 #允许返回给客户端的最大 TTL 值 rr-ttl-reply-max 60 #最大并发请求数量 max-query-limit 65535 #首次查询响应模式 response-mode first-ping #过期缓存服务功能 serve-expired yes #--------提前加载 serve-expired-prefetch-time 21600 # 提前4小时预取 serve-expired-ttl 259200 # 过期缓存保留半天 serve-expired-reply-ttl 3 cache-checkpoint-time 300 # 5分钟保存间隔 #----国内DNS组----# server-tls 223.6.6.6 -group cn -subnet 202.96.128.0/24 server-tls dot.pub -group cn -subnet 202.96.128.0/24 server-tls 2400:3200::1 -group cn -subnet 202.96.128.0/24 #----国外DNS组----# #TLS配置 server-tls dns.google -group gw -exclude-default-group server-tls 1.1.1.1 -group gw -exclude-default-group #-----fallback服务器 #tls走代理组 server-tls dns.google -group gw -proxy proxy -exclude-default-group -fallback -no-dualstack-selection -no-speed-check server-tls 1.1.1.1 -group gw -proxy proxy -exclude-default-group -fallback -no-speed-check #HTTPS走代理组 server-https https://dns.google/dns-query -group gw -proxy proxy -exclude-default-group -fallback -no-speed-check server-https https://1.1.1.1/dns-query -group gw -proxy proxy -exclude-default-group -fallback -no-speed-check ##----国内常用媒体使用udp----查询 server 202.96.128.86 -group zl -exclude-default-group -subnet 202.96.128.0/24 server 202.96.134.33 -group zl -exclude-default-group -subnet 202.96.128.0/24 server 223.5.5.5 -group zl -exclude-default-group -subnet 202.96.128.0/24 #----域名集zl使用zl组查询 domain-set -name zl -type list -file /etc/smartdns/domain/zl.list nameserver /domain-set:zl/zl ##bootstrap服务器 server 223.5.5.5 -bootstrap-dns

重现步骤 1.dns查询路径。客户端---adguardhome(记录查询)---mosdns(分流)---(国内外组) 2.windows,dig命令调试aliyun.com域名,如下结果: ANSWER SECTION: aliyun.com. 60 IN A 106.11.248.146 aliyun.com. 60 IN A 140.205.60.46

信息收集

  1. 将/var/log/smrtdns.log日志作为附件上传(注意去除个人相关信息)。
  2. 如进程异常,请将coredump功能开启,上传coredump信息文件,同时上传配套的smartdns进程文件。
    在自定义界面,开启设置->自定义设置->生成coredump配置,重现问题后提交coredump文件 coredump文件在/tmp目录下

kevin-312 avatar Oct 07 '25 07:10 kevin-312

有没有可能查询都送到6553端口了

PikuZheng avatar Oct 07 '25 08:10 PikuZheng

代码是正常的,你没开IPV6优选吧! root@ImmortalWrt:~# nslookup example.com 127.0.0.1 Server: 127.0.0.1 Address: 127.0.0.1:53

Non-authoritative answer: Name: example.com Address: 23.215.0.136 Name: example.com Address: 23.220.75.245 Name: example.com Address: 23.192.228.80 Name: example.com Address: 23.220.75.232

Non-authoritative answer: Name: example.com Address: 2600:1406:5e00:6::17ce:bc1b Name: example.com Address: 2600:1406:5e00:6::17ce:bc12 Name: example.com Address: 2600:1408:ec00:36::1736:7f24 Name: example.com Address: 2600:1406:bc00:53::b81e:94ce

root@ImmortalWrt:~#

xiaobaishu1 avatar Oct 08 '25 01:10 xiaobaishu1

有没有可能查询都送到6553端口了

dig命令调试,都尝试6053,6553,53,查看审计日志,依然是没有返回ipv6,即使dualstack-ip-selection yes,dualstack-ip-selection-threshold 50这两个ip优选打开,一样不行。

kevin-312 avatar Oct 08 '25 03:10 kevin-312

代码是正常的,你没开IPV6优选吧! root@ImmortalWrt:~# nslookup example.com 127.0.0.1 Server: 127.0.0.1 Address: 127.0.0.1:53

Non-authoritative answer: Name: example.com Address: 23.215.0.136 Name: example.com Address: 23.220.75.245 Name: example.com Address: 23.192.228.80 Name: example.com Address: 23.220.75.232

Non-authoritative answer: Name: example.com Address: 2600:1406:5e00:6::17ce:bc1b Name: example.com Address: 2600:1406:5e00:6::17ce:bc12 Name: example.com Address: 2600:1408:ec00:36::1736:7f24 Name: example.com Address: 2600:1406:bc00:53::b81e:94ce

root@ImmortalWrt:~#

#dualstack-ip-selection yes #dualstack-ip-selection-threshold 50,这两行ip优选取消注释也不行。如果你用我的代码,可以的话。那就是其他网络问题。

kevin-312 avatar Oct 08 '25 03:10 kevin-312

连接到运行日志流.... 已连接到运行日志流。 连接到审计日志流.... 已断开与运行日志流的连接。 已连接到审计日志流。 [2025-10-08 12:09:33,337] 127.0.0.1 query www.kernel.org, type 28, time 225ms, speed: 139.9ms, group default, result 2a04:4e42:8c::311 [2025-10-08 12:09:33,338] API query www.kernel.org, type 28, time 218ms, speed: 139.9ms, group default, result 2a04:4e42:8c::311 [2025-10-08 12:09:33,338] 127.0.0.1 query www.kernel.org, type 1, time 225ms, speed: 136.9ms, group default, result 146.75.113.55 [2025-10-08 12:09:33,338] API query www.kernel.org, type 1, time 222ms, speed: 136.9ms, group default, result 146.75.113.55

没开任何代理的情况下测试的 有IPV6返回,运行日志里面也拿看到有IPV6查询跟返回!代码是没问题的!要么你自己的配置有问题要么就是网络问题!

xiaobaishu1 avatar Oct 08 '25 04:10 xiaobaishu1

dualstack-ip-selection 这个默认值是yes,要设成no才行

PikuZheng avatar Oct 08 '25 05:10 PikuZheng

另外你用的dig完整的命令是什么

PikuZheng avatar Oct 08 '25 05:10 PikuZheng

另外你用的dig完整的命令是什么

smartdns服务端地址192.168.68.15,端口53,6053,6553.windows用dig @192.168.68.15 -p53/6053/6553 aliyun.com。一样不行,感觉真奇怪的。

kevin-312 avatar Oct 08 '25 10:10 kevin-312

另外你用的dig完整的命令是什么

smartdns服务端地址192.168.68.15,端口53,6053,6553.windows用dig @192.168.68.15 -p53/6053/6553 aliyun.com。一样不行,感觉真奇怪的。

有没有可能这个命令只查询ipv4,不查询ipv6的

PikuZheng avatar Oct 08 '25 10:10 PikuZheng

dig aaaa @192.168.68.15 -p 53/6053/6553 aliyun.com 试试

cqcw123123 avatar Oct 15 '25 01:10 cqcw123123