大佬帮看下为什么网站加上 www 后 dns 就无响应了

26 天前
 FaiChou

网站是 okx (www.okx.com), 而且目前只发现 okx 有问题,浏览器打开会秒响应 DNS_PROBE_FINISHED_NXDOMAIN

下面是我本地的一些测试:


➜  ~ nslookup www.baidu.com
Server:		2408:8215:f29:16f0::1
Address:	2408:8215:f29:16f0::1#53

www.baidu.com	canonical name = www.a.shifen.com.
Name:	www.a.shifen.com
Address: 110.242.68.4
Name:	www.a.shifen.com
Address: 110.242.68.3

➜  ~ nslookup www.okx.com
Server:		2408:8215:f29:16f0::1
Address:	2408:8215:f29:16f0::1#53

*** Can't find www.okx.com: No answer

➜  ~ nslookup okx.com
Server:		2408:8215:f29:16f0::1
Address:	2408:8215:f29:16f0::1#53

Name:	okx.com
Address: 43.198.216.245
Name:	okx.com
Address: 16.163.134.231
Name:	okx.com
Address: 43.199.123.175

➜  ~ curl okx.com
<html>
<head><title>301 Moved Permanently</title></head>
<body>
<center><h1>301 Moved Permanently</h1></center>
</body>
</html>
➜  ~ curl https://okx.com
<html>
<head><title>301 Moved Permanently</title></head>
<body>
<center><h1>301 Moved Permanently</h1></center>
</body>
</html>
➜  ~ curl https://www.okx.com
curl: (6) Could not resolve host: www.okx.com

家里所有设备打开这个 okx 都是秒拒。

OpenWrt 作为软路由,它负责拨号上网,并且里面跑着 openclash ,dns 是 Dnsmasq 。

连接 OpenWrt 的是路由器,作为中继充当无线交换机。

我尝试过关闭 openclash ,网站还是一样打不开。

在 OpenWrt 中调试:

$ nslookup www.okx.com
Server:		127.0.0.1
Address:	127.0.0.1:53




# root @ OpenWrt in ~ [9:41:51]
$ nslookup www.baidu.com
Server:		127.0.0.1
Address:	127.0.0.1:53


www.baidu.com	canonical name = www.a.shifen.com
Name:	www.a.shifen.com
Address: 110.242.68.3
Name:	www.a.shifen.com
Address: 110.242.68.4


# root @ OpenWrt in ~ [9:42:03]
$ nslookup okx.com
Server:		127.0.0.1
Address:	127.0.0.1:53

Name:	okx.com
Address: 16.163.134.231
Name:	okx.com
Address: 43.199.123.175
Name:	okx.com
Address: 43.198.216.245

okx 只要是加上 www 后就无法获取到 ip 地址了。

另外也重启过很多次 Dnsmasq (/etc/init.d/dnsmasq restart), 都没效果。

hosts 文件也没问题:

$ cat /etc/hosts
127.0.0.1 localhost

::1     localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

目前来看,和 OpenClash 关系不大,因为请求就没有走到 OC 里面。

下面是配置项:

$ cat /etc/config/dhcp
config dnsmasq
	option domainneeded '1'
	option boguspriv '1'
	option filterwin2k '0'
	option localise_queries '1'
	option rebind_protection '1'
	option rebind_localhost '1'
	option local '/lan/'
	option domain 'lan'
	option expandhosts '1'
	option nonegcache '0'
	option authoritative '1'
	option readethers '1'
	option leasefile '/tmp/dhcp.leases'
	option nonwildcard '1'
	option localservice '1'
	option ednspacket_max '1232'
	option filter_aaaa '0'
	option filter_a '0'
	option localuse '1'
	option port '53'
	list server '127.0.0.1#7874'
	option noresolv '1'
	option cachesize '0'
3090 次点击
所在节点    程序员
13 条回复
Kinnice
26 天前
https://www.itdog.cn/dns/www.okx.com
因为 okx 在国内解析就是内网 ip ,且 dnsmasq 默认会有重绑定保护,会禁掉这个 ip ,因此就是没记录啦.
xixiv5
26 天前
我是 Apple music 的 is1-ssl.mzstatic.com 这个域名解析不出来 时而可以时而不可以,找不到问题在哪
aincvy
26 天前
添加 1.1.1.1 作为 dns 上游服务器 应该可以解决问题。。

```
C:\Users\admin>nslookup www.okx.com 1.1.1.1
Server: one.one.one.one
Address: 1.1.1.1

Non-authoritative answer:
Name: www.okx.com.cdn.cloudflare.net
Addresses: 2606:4700:4400::6812:2bae
2606:4700:4400::ac40:9052
104.18.43.174
172.64.144.82
Aliases: www.okx.com

```
xuecan
26 天前
因为被墙了
FaiChou
26 天前
@Kinnice 哦,我可能懂了。昨晚我在 OpenClash 内加了一个规则,`-DOMAIN-SUFFIX, okx.com, PROXY`,不起作用。请求没走 OpenClash ,还是先进行了 dns 解析。应该是加的位置不对,我尝试把它放到最前面试试。
afn988
26 天前
OpenWrt 里面的 DHCP ,重绑定保护(丢弃 RFC1918 上行响应数据),取消勾勾,再尝试下
FaiChou
26 天前
我把 `-DOMAIN-SUFFIX, okx.com, PROXY` 放到最上面。按理说请求应该先到达 openclash ,然后再决定是否解析 dns ,但好像即使这样的规则,也不会走 oc 。并且我把 oc 的“实验性:绕过大陆 ip”给关了,并且重启了一下 dns ,仍然不行。
FaiChou
26 天前
@afn988 我 dhcp 没配置这个,dnsmasq 有这个,我试过还是一样:

$ cat /etc/config/dhcp

config dnsmasq
option domainneeded '1'
option boguspriv '1'
option filterwin2k '0'
option localise_queries '1'
option rebind_protection '1'
option rebind_localhost '1'
option local '/lan/'
option domain 'lan'
option expandhosts '1'
option nonegcache '0'
option authoritative '1'
option readethers '1'
option leasefile '/tmp/dhcp.leases'
option nonwildcard '1'
option localservice '1'
option ednspacket_max '1232'
option filter_aaaa '0'
option filter_a '0'
option localuse '1'
option port '53'
list server '127.0.0.1#7874'
option noresolv '1'
option cachesize '0'

config dhcp 'lan'
option interface 'lan'
option start '100'
option limit '150'
option leasetime '12h'
option dhcpv4 'server'
option ra_slaac '1'
list ra_flags 'managed-config'
list ra_flags 'other-config'
option force '1'
option ra 'server'
option dhcpv6 'server'
option ra_management '1'

config dhcp 'wan'
option interface 'wan'
option ignore '1'
afn988
26 天前
你配置中的 config dnsmasq 替换成这段试试
----------------------------
config dnsmasq
option localise_queries '1'
option local '/lan/'
option domain 'lan'
option expandhosts '1'
option readethers '1'
option leasefile '/tmp/dhcp.leases'
option nonwildcard '1'
option localservice '1'
option ednspacket_max '1232'
option localuse '1'
option filter_aaaa '1'
option domainneeded '1'
option noresolv '1'
list server '127.0.0.1#7874'
option cachesize '0'
option rebind_protection '1'
Ipsum
26 天前
返回的 ip 都是污染 ip ,你 clash 规则放哪都不好使。想解决 clash 就得用 tls 的 dns ,然后通过 clash 的 dns 服务去请求。
chen05
26 天前
阿里返回的
http://119.29.29.29/d?dn=www.okx.com 169.254.0.2

本地解析 看你是到 cname:awscn.okpool.top
然后 awscn.okpool.top 到 169.254.0.2

因此需要检查一下 awscn.okpool.top 这个解析是怎么配置的
是不是没有配置对

绕过大陆 ip 的前提是获得 ip 后进行匹配
但 169.254.0.0/16 在本地 IPv4 绕过地址列表里
z1037787162
11 天前
博主,你的写法怎么写的,图床挂了,我也强烈需要这个,先谢谢了。
FaiChou
10 天前
@z1037787162 图床没挂,你需要挂代理。imgur

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/1067414

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX