下面是我本地的一些测试:
➜ ~ 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
301 Moved Permanently
301 Moved Permanently
➜ ~ curl https://okx.com
301 Moved Permanently
301 Moved Permanently
➜ ~ 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'
我解决了,问题应该是这样的,openclash 没有 fakeip ,它还有一个绕过大陆 ip 的功能,所以域名的请求都会先经过 DNS ,获取到 ip 后再决定是否处理,但是被污染后获取到的是一个本地地址(169.254.0.0/16),所以被 bypasss 了。
OC 中有第二 DNS 服务器功能,可以强制某个域名走这个 DNS ,于是可以这样写: