众所周知,dns over https是一个很好的解决dns污染的方法。cloudflare是为数不多的支持dns over https的dns厂家。但是恰恰cloudflare在国内的延迟十分感人。导致我家的解析延时居高不下(如图),这个问题困扰了我很久。Adguard.png
今天在折腾我的香港轻量的时候意外发现,我的香港轻量到cloudflare居然只有1.4ms的延迟。

PING cloudflare-dns.com (104.16.248.249) 56(84) bytes of data.
64 bytes from 104.16.248.249: icmp_seq=1 ttl=59 time=1.49 ms
64 bytes from 104.16.248.249: icmp_seq=2 ttl=59 time=1.49 ms
64 bytes from 104.16.248.249: icmp_seq=3 ttl=59 time=1.52 ms
64 bytes from 104.16.248.249: icmp_seq=4 ttl=59 time=1.53 ms
64 bytes from 104.16.248.249: icmp_seq=5 ttl=59 time=1.50 ms
64 bytes from 104.16.248.249: icmp_seq=6 ttl=59 time=1.53 ms
64 bytes from 104.16.248.249: icmp_seq=7 ttl=59 time=1.53 ms
64 bytes from 104.16.248.249: icmp_seq=8 ttl=59 time=1.68 ms
64 bytes from 104.16.248.249: icmp_seq=9 ttl=59 time=1.56 ms
64 bytes from 104.16.248.249: icmp_seq=10 ttl=59 time=1.50 ms

--- cloudflare-dns.com ping statistics ---
10 packets transmitted, 10 received, 0% packet loss, time 9015ms
rtt min/avg/max/mdev = 1.491/1.537/1.681/0.057 ms

而我家到香港轻量也才不到30ms延迟。于是我萌生出一个大胆的想法--端口转发。用socat转发了443端口的流量。然后吧本地的hosts修改成我香港轻量的,一下子解析速度就上去了。

Last modification:February 25, 2020
If you think my article is useful to you, please feel free to appreciate