結果:
140.82.113.4 github.com
13.229.188.59 github.com
13.114.40.48 github.com
185.199.110.153 github.com
185.199.111.153 github.com
185.199.109.153 github.com
185.199.108.153 github.com
66.220.147.11 fastly.net
203.208.39.99 fastly.net
104.244.46.85 fastly.net
199.232.69.194 fastly.net
185.199.110.133 githubusercontent.com
185.199.108.133 githubusercontent.com
185.199.109.133 githubusercontent.com
185.199.111.133 githubusercontent.com
https://www.ipaddress.com/search/
http://tool.chinaz.com/dns/
過程:【最新】解決Github網頁上圖片顯示失敗的問題
一、問題
比如隨便打開一個項目,圖片都不能顯示了,我頭像也沒了,真是一個令人傷心的事F12
打開控制台看一哈
呦,一堆紅色×。主要報錯是Failed to load resource: net::ERR_CERT_COMMON_NAME_INVALID
去查了一下,博主john-zeng這樣解釋道:
實際上,可以認為,
ERR_CERT_COMMON_NAME_INVALID
就是用一個錯誤的域名訪問了某個節點的https
資源。導致這個錯誤的原因,基本是:
- dns污染
- host設置錯誤
- 官方更新了dns,但是dns緩存沒有被更新,導致錯誤解析。
我覺得像是有點道理,解決方法就粗來了,hin簡單,往下看。
二、解決方法
主要思路就是使用本地hosts
文件對網站進行域名解析,一般的DNS
問題都可以通過修改hosts
文件來解決,github
的CDN
域名被污染問題也不例外,同樣可以通過修改hosts
文件解決,將域名解析直接指向IP
地址來繞過DNS
的解析,以此解決污染問題。
2.1 找到URL
打開github
任意未顯示圖片的網頁,使用元素選擇器(Ctrl+Shift+C
)放在顯示不了的圖片上,或者在無法顯示的圖片上右鍵-檢查元素,定位到該圖片的標簽,那么你得到了它的URL,叫做src
屬性。
比如介個
在右面把它的網址復制粗來:
https://avatars2.githubusercontent.com/u/15832957?s=60&v=4
2.2 獲取IP地址
得到上述網址以后打開IPAddress.com這個網站,在搜索框輸入它的域名,就是https://
到com
那一部分,俗稱二級域名:
avatars2.githubusercontent.com
回車!!!下面你會看到該域名的信息和IP
地址:
可以看出IP是:151.101.184.133
,並且是2019.05.05最后更新的,alright,那么我們就可以使這個IP和域名映射起來。
(其他如果有掛掉的圖片一樣使用此方法進行一一映射即可。)
2.3 修改hosts
具體咋映射呢?修改hosts
文件!!!本人使用的是windows
系統,所以使用Sublime Text
打開:C:\Windows\System32\drivers\etc\hosts
在文件末尾添加:
可以直接選中以下內容復制粘貼,20210119有效(包括MAC系統)20210123更新
# GitHub Start 140.82.113.3 github.com 140.82.114.20 gist.github.com 151.101.184.133 assets-cdn.github.com 151.101.184.133 raw.githubusercontent.com 199.232.28.133 raw.githubusercontent.com 151.101.184.133 gist.githubusercontent.com 151.101.184.133 cloud.githubusercontent.com 151.101.184.133 camo.githubusercontent.com 199.232.96.133 avatars.githubusercontent.com 151.101.184.133 avatars0.githubusercontent.com 199.232.68.133 avatars0.githubusercontent.com 199.232.28.133 avatars0.githubusercontent.com 199.232.28.133 avatars1.githubusercontent.com 151.101.184.133 avatars1.githubusercontent.com 151.101.108.133 avatars1.githubusercontent.com 151.101.184.133 avatars2.githubusercontent.com 199.232.28.133 avatars2.githubusercontent.com 151.101.184.133 avatars3.githubusercontent.com 199.232.68.133 avatars3.githubusercontent.com 151.101.184.133 avatars4.githubusercontent.com 199.232.68.133 avatars4.githubusercontent.com 151.101.184.133 avatars5.githubusercontent.com 199.232.68.133 avatars5.githubusercontent.com 151.101.184.133 avatars6.githubusercontent.com 199.232.68.133 avatars6.githubusercontent.com 151.101.184.133 avatars7.githubusercontent.com 199.232.68.133 avatars7.githubusercontent.com 151.101.184.133 avatars8.githubusercontent.com 199.232.68.133 avatars8.githubusercontent.com 199.232.96.133 avatars9.githubusercontent.com # GitHub End
然后保存文件就OK了,至於無法保存,沒有修改權限,鼠標右鍵-屬性-安全-修改權限;或將hosts
文件復制一份,修改之后,復制到原文件夾替換!
三、最后說幾句
還可以使用ipconfig/flush
對本地DNS緩存進行一次刷新,如果遇到網絡異常,可能是DNS緩存的問題,刷新一下,步驟。
- windows開始→運行→輸入:CMD 按回車鍵,打開命令提示符窗口。
- 再輸入: ipconfig /flushdns 回車,執行命令,可以重建本地DNS緩存。
再附上幾個命令:
ipconfig /displaydns # 顯示dns緩存 ipconfig /flushdns # 刷新DNS記錄 ipconfig /renew # 重請從DHCP服務器獲得IP
PS:另外要注意的一點就是,如果圖片再次不能顯示,只需要及時更新IP就行啦,這波操作不麻煩,你看我頭像回來了!!!
https://blog.csdn.net/qq_38232598/article/details/91346392
如何快速訪問github(簡單易懂)
一、
經常訪問github,網絡卡頓讓人難以接受,上網搜集了一下資料,結合自己的經驗,分享給大家。
二、
1、打開DNS查詢工具:http://tool.chinaz.com/dns
2、查詢步驟如下:選擇TTL值較低的,如果當前列表沒有否和要求的IP,重新檢測。
3、找到host文件,將找到的IP按照下面的格式放入Host文件保存,訪問就提速了。
#13.229.188.59 https://github.com
如下:
三、用命令查找host文件,請參考http://www.bigbaicai.com/dnkt/4049.html