Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

求助:macOS安装SmartDNS www.qq.com 访问异常 #182

Open
sdvegeta opened this issue Nov 23, 2023 · 15 comments
Open

求助:macOS安装SmartDNS www.qq.com 访问异常 #182

sdvegeta opened this issue Nov 23, 2023 · 15 comments

Comments

@sdvegeta
Copy link

系统版本是 macOS Big Sur 11.7.10 (20G1427) 通过brew安装的smartdns 0.6.5

遇到了奇怪的问题,nslookup解析www.qq.com没问题,但ping 就ping 不通,而且浏览器访问就如下错误
image

image

换用docker版的smartdns 就没问题。

conf文件如下
image

不知道是什么原因造成,求助各位大佬。

@sdvegeta sdvegeta changed the title 求助:macOS安装SmartDNS www.qq.com 能解析但 求助:macOS安装SmartDNS www.qq.com 访问异常 Nov 23, 2023
@sdvegeta
Copy link
Author

补充一个信息用了 ClashX ,但情况一样的,用docker 安装的SmartDNS 就一切正常。
除了 www.qq.com 还有 www.jd.com 也出现同样的访问异常

@mokeyish
Copy link
Owner

你这配置上游服务写太多了啊。这样其实会影响响应速度的。
然后尽量用 https,这样才能保护隐私,dns 我不会被篡改。

参考这个配置

# 在本地 53 端口监听
bind 127.0.0.1:53  

# 配置 bootstrap-dns,如不配置则调用系统的,建议配置,这样就加密了。
server https://223.5.5.5/dns-query  -bootstrap-dns -exclude-default-group

# 配置默认上游服务器
server https://dns.alidns.com/dns-query
server https://doh.pub/dns-query

# 配置公司(家里)上游服务器
server 192.168.1.1 -exclude-default-group -group office

# 以 ofc 结尾的域名转发至 office 分组进行解析
nameserver /ofc/office

# 设置域名的静态 IP
address /test.example.com/1.2.3.5

# 屏蔽域名(广告屏蔽)
address /ads.example.com/#

@mokeyish
Copy link
Owner

macos /etc/resolvconf 要改,网卡上也要改dns服务器地址。

@sdvegeta
Copy link
Author

macos /etc/resolvconf 要改,网卡上也要改dns服务器地址。

网卡dns改了
macos /etc/resolvconf 这个没改,我去看看这个

@sdvegeta
Copy link
Author

sdvegeta commented Nov 23, 2023

macos /etc/resolvconf 要改,网卡上也要改dns服务器地址。

image

也有指向127.0.0.1 呀,这样对的吧。

@mokeyish
Copy link
Owner

我也是在 macos 上用的,试试清理缓存 sudo dscacheutil -flushcache

再不行,得一个一个试了,减少上游服务器,关闭其他代理软件,等等找出原因。

@sdvegeta
Copy link
Author

sdvegeta commented Nov 23, 2023

networksetup -listallnetworkservices

你这配置上游服务写太多了啊。这样其实会影响响应速度的。 然后尽量用 https,这样才能保护隐私,dns 我不会被篡改。

参考这个配置

# 在本地 53 端口监听
bind 127.0.0.1:53  

# 配置 bootstrap-dns,如不配置则调用系统的,建议配置,这样就加密了。
server https://223.5.5.5/dns-query  -bootstrap-dns -exclude-default-group

# 配置默认上游服务器
server https://dns.alidns.com/dns-query
server https://doh.pub/dns-query

# 配置公司(家里)上游服务器
server 192.168.1.1 -exclude-default-group -group office

# 以 ofc 结尾的域名转发至 office 分组进行解析
nameserver /ofc/office

# 设置域名的静态 IP
address /test.example.com/1.2.3.5

# 屏蔽域名(广告屏蔽)
address /ads.example.com/#

用你这个配置conf就可以

找到原因了,是因为

speed-check-mode ping,tcp:80,tcp:443

response-mode fastest-ip

这两行,测速的。
可我就很想用这个测速找出最快ip的能力啊,不知道为什么加了这两行就不行。

@mokeyish
Copy link
Owner

ping 最快,不代表那个 ip 的网站服务是正常的。

@sdvegeta
Copy link
Author

ping 最快,不代表那个 ip 的网站服务是正常的。

一般来说是正常的嘛

想不明白为什么我开启了测速就异常了,用win WSL的SmartDNS,和macOS下用docker版本SmartDNS都没问题

有测速选择最快的,我ping qq.com 响应10ms以内,不测速选择最快的 经常响应 50ms+ ,某种程度来说就是慢了,总想追求最快的嘛

@mokeyish
Copy link
Owner

主要是网站访问的话,你可以把 https 测放最前面。ping 放最后面。

@mokeyish
Copy link
Owner

https 放最后面,只有当服务器禁止了 ping,全都失败了,才会去跑 https 测速。

@sdvegeta
Copy link
Author

sdvegeta commented Nov 24, 2023

https 放最后面,只有当服务器禁止了 ping,全都失败了,才会去跑 https 测速。

现在情况是,只要conf中添加了 测试模式那一行,就会出现域名无法解析的情况,注释掉就好了。
speed-check-mode tcp:443,tcp:80,ping ,三种测速模式都分别单独试过了,结果表现一样

Min@smartdns ~ % ping qq.com
ping: cannot resolve qq.com: Unknown host
Min@smartdns ~ % ping qq.com
ping: cannot resolve qq.com: Unknown host
Min@smartdns ~ % nslookup qq.com
;; connection timed out; no servers could be reached

Min@smartdns ~ % nslookup qq.com
Server: 127.0.0.1
Address: 127.0.0.1#53

Non-authoritative answer:
Name: qq.com
Address: 123.150.76.218
Name: qq.com
Address: 113.108.81.189

@mokeyish
Copy link
Owner

用 https,http ,这个库是实现了真实的 https ping 的。
https://github.com/mokeyish/smartdns-rs/blob/main/src/infra/ping.rs#L661

这里测速的代码逻辑:
https://github.com/mokeyish/smartdns-rs/blob/main/src/dns_mw_ns.rs#L221

@sdvegeta
Copy link
Author

用 https,http ,这个库是实现了真实的 https ping 的。 https://github.com/mokeyish/smartdns-rs/blob/main/src/infra/ping.rs#L661

这里测速的代码逻辑: https://github.com/mokeyish/smartdns-rs/blob/main/src/dns_mw_ns.rs#L221

我明白你的意思,可我不是技术侧的,只好先这样了 😭

@PikuZheng
Copy link
Contributor

你的smartdns需要以管理员身份运行,不然测速不能完成

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants