本文介绍通过修改系统hosts文件的办法,绕过国内dns解析,直接访问GitHub的CDN节点,从而达到加速的目的。不需要科学上网,也不需要海外的服务器辅助。
提示:以下是本篇文章正文内容,下面案例可供参考
打开https://www.ipaddress.com/
查询以下三个链接的DNS解析地址:
github.com assets-cnd.github.com gibhut.global.ssl.fastly.net记录下查询到的IP地址。
路径:C:\Windows\System32\drivers\etc 在末尾添加三行记录并保存。(需管理员权限,注意IP地址与域名间需留有空格)
# Copyright (c) 1993-2009 Microsoft Corp. # # This is a sample HOSTS file used by Microsoft TCP/IP for Windows. # # This file contains the mappings of IP addresses to host names. Each # entry should be kept on an individual line. The IP address should # be placed in the first column followed by the corresponding host name. # The IP address and the host name should be separated by at least one # space. # # Additionally, comments (such as these) may be inserted on individual # lines or following the machine name denoted by a '#' symbol. # # For example: # # 102.54.94.97 rhino.acme.com # source server # 38.25.63.10 x.acme.com # x client host # localhost name resolution is handled within DNS itself. # 127.0.0.1 localhost # ::1 localhost 140.82.113.3 github.com 185.199.108.153 assets-cdn.github.com 199.232.69.194 github.global.ssl.fastly.net上面hosts文件里的地址要填写自己查询到的地址
Windows+X 打开系统命令行(管理员身份)或powershell。
运行 ipconfig /flushdns 手动刷新系统DNS缓存。