Popular blog tags

Make your github.com faster (github.com加速教程)

Published
 
 

解决方案

 

part 1 直接修改 hosts 文件

 
1.获取无法访问的Github的真实ip地址
2.修改 hosts 文件,让域名直接指向真实的IP,绕过DNS 域名解析
3.更新dns缓存,让修改的数据立即生效
 

part 2 FastGithub c#

 
github加速神器,解决github打不开、用户头像无法加载、releases无法上传下载、git-clone、git-pull、git-push失败等问题。
https://github.com/dotnetcore/FastGithub
 
github.global.ssl.fastly.net 
assets-cdn.github.com
 
how to use on windows 10
 
step 1:Download fastgithub.exe 
 
step 2:Open cmd as Administrator
 
step 3: Run fastgithub.exe 
fastgithub.exe start // 以windows服务安装并启动
 

GitHub在国内访问速度慢的问题原因

 
GitHub在国内访问速度慢的问题原因有很多,但最直接和最主要的原因是GitHub的分发加速网络的域名遭到dns污染。
 
优化思路:绕过国内dns解析,直接在本地将github域名绑定GitHub的CDN节点ip。
 
基本知识:
1.IP存在时效性
2.不同地区的不同时间,获取的高速地址可能不同

情景1

1.1.运行maui-check 时提示raw.githubusercontent.com:443无法连接服务器

maui-check

output

提示raw.githubusercontent.com:443无法连接服务器
 

1.2.解决办法

 

1.2.1 首先要找到raw.githubusercontent.com对应的IP

 
step 1:首先打开https://githubusercontent.com.ipaddress.com/
 
step 2:输入raw.githubusercontent.com
 
step 3:获取到4个ip
raw.githubusercontent.com resolves to the following 4 IPv4 addresses:
185.199.108.133
185.199.109.133
185.199.110.133
185.199.111.133
 

1.2.2 修改hosts

 
Step 4:修改hosts
 
C:\Windows\System32\drivers\etc  (Windows 10)
 
# 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
185.199.108.133  raw.githubusercontent.com
 
Step 5:保存时提示没有权限,修改 User 权限(全部控制),保存后再复原 User 用户权限
 
2.获取github的IP地址
nslookup github.com 8.8.8.8
nslookup raw.githubusercontent.com 8.8.8.8

访问:https://www.ipaddress.com/ 网址 依次获取以下三个网址的IP

  1. github.com
  2. github.global.ssl.fastly.net
  3. codeload.github.com
# Github
151.101.44.249 github.global.ssl.fastly.net
192.30.253.113 github.com
103.245.222.133 assets-cdn.github.com
23.235.47.133 assets-cdn.github.com
203.208.39.104 assets-cdn.github.com
204.232.175.78 documentcloud.github.com
204.232.175.94 gist.github.com
107.21.116.220 help.github.com
207.97.227.252 nodeload.github.com
199.27.76.130 raw.github.com
107.22.3.110 status.github.com
204.232.175.78 training.github.com
207.97.227.243 www.github.com
185.31.16.184 github.global.ssl.fastly.net
185.31.18.133 avatars0.githubusercontent.com
185.31.19.133 avatars1.githubusercontent.com

2.修改系统hosts

通过修改 Hosts 文件,将域名解析直接指向 IP 地址来绕过 DNS 的解析

添加内容

C:\Windows\System32\drivers\etc\hosts

192.30.253.113 github.com 
151.101.25.194 github.global.ssl.fastly.net 
192.30.253.121 codeload.github.com
 
 

windows系统

  1. hosts文件路径:C:\Windows\System32\drivers\etc\hosts ,
  2. 添加上面查询到的IP到hosts文件中(此时可能需要管理员权限,可以将hosts复制到桌面,修改好了再复制回去覆盖原先的)
  3. 结果:
    在这里插入图片描述
3.刷新DNS
 ipconfig /flushdns

https://tools.ipip.net/traceroute.php

方法2. 更改DNS,下面是可靠的DNS服务供应商(对win系统方便)
V2EX DNS  :199.91.73.222    178.79.131.110
阿里DNS   :223.5.5.5        223.6.6.6
Google DNS:8.8.8.8          8.8.4.4
OpenDNS   :208.67.222.222   208.67.220.220

 

vs2019下载和更新速度非常慢的解决方案

查询微软的下载网站的域名 download.visualstudio.microsoft.com,找到最近的cdn节点

visit

http://tool.chinaz.com/dns

output

湖南[联通]  13.229.188.59 [新加坡 Amazon数据中心] 38

新疆[联通]  66.249.89.104 [美国 Google]                     3600

我看到TTL最小的是湖南联通和江西联通的节点最快。

于是,我复制下IP,找到本机C:\Windows\System32\drivers\etc 下的hosts文件

然后添加一行

 
110.53.72.104 download.visualstudio.microsoft.com
然后刷新dns,ping一下看看hosts文件有没有生效,无效的话,检查,有效的话,关闭掉vs installer,然后重新启动,速度蹭蹭的起来了。

 

2.利用CloudflareWorkers加速Github

https://haoduck.com/575.html

3.借用码云https://gitee.com/ 下载zip

git clone每次都是下载一部分就断掉

https://www.cnblogs.com/USTC-ZCC/p/11163292.html

Useful links

https://www.cnblogs.com/boxrice/p/11670444.html

 

了解一下DNS工作原理

linux下如何修改DNS地址​

win10系统如何更改DNS