如何更快进行DNS解析
科学了,发现访问很慢,有时还无法访问,明显是被某种神秘的东方力量给阻断了。
DNS解析就起作用了。可以快速寻址,目前国内比较知名的且比较快的就是阿里云的:223.5.5.5。但是呢,这还需要看你自己的网络是哪家的,去访问国际的时候路由节点是否在国内来回的跳了。
为了自己能快速的找到属于自家网络最快的DNS解析服务器,我整理了全球公共的DNS IPv4的IP地址,如下
"114.114.114.114","114.114.115.115","119.29.29.29","182.254.116.116","101.226.4.6","218.30.118.6","123.125.81.6","140.207.198.6","1.2.4.8","210.2.4.8","8.8.8.8","8.8.4.4","1.1.1.1","1.0.0.1","9.9.9.9","185.222.222.222","185.184.222.222","208.67.222.222","208.67.220.220","199.91.73.222","178.79.131.110","223.5.5.5","223.6.6.6","183.60.83.19","183.60.82.98","180.76.76.76","4.2.2.1","4.2.2.2","122.112.208.1","139.9.23.90","114.115.192.11","116.205.5.1","116.205.5.30","122.112.208.175","139.159.208.206","180.184.1.1","180.184.2.2","168.95.192.1","168.95.1.1","203.80.96.10","203.80.96.9","199.85.126.10","199.85.127.10","216.146.35.35","216.146.36.36","64.6.64.6","64.6.65.6",
具体的Python脚本如下
import time import ping3 # 假设使用的是ping3库进行ping操作def ping_ip(ip):ping_times = []for _ in range(5): # Ping每个IP 5次start_time = time.time()response = ping3.ping(ip, timeout=1) # 设置超时为1秒end_time = time.time()if response is not None:delay = end_time - start_timeping_times.append(delay)avg_response_time = sum(ping_times) / len(ping_times) if ping_times else Nonereturn ip, avg_response_time# 全球公共dns ip ips = ["114.114.114.114","114.114.115.115","178.79.131.110","223.5.5.5","223.6.6.6", ] results = [ping_ip(ip) for ip in ips]# 过滤掉没有有效响应时间的IP results = [(ip, avg_response_time) for ip, avg_response_time in results if avg_response_time is not None]# 按照平均响应时间排序结果 results.sort(key=lambda x: x[1])# 打印延时最短的5个IP print("延时最短的5个IP:") for i in range(min(5, len(results))):print(f"{i + 1}. IP地址: {results[i][0]}, 平均响应时间: {results[i][1]:.3f} 秒")
最后,我贴一张我当前网络最快的前5个DNS IP
对应DNS查询链接:https://dnsdaquan.com/
微信双开
Windows微信双开 @echo off start "" "C:\Program Files (x86)\Tencent\WeChat\WeChat.exe" start "" "C:\Program Files (x86)\Tencent\WeChat\WeChat.exe" exit