獲取IP地址
查詢 以下域名IP地址
- github.com
- github.global.ssl.fastly.net
- assets-cdn.github.com
通過在線網址查詢:https://websites.ipaddress.com/ 或 http://tool.chinaz.com/dns/
前面兩個地址都是一個 IP地址,最后一個是四個
記錄如下
140.82.114.4 github.com
185.199.110.153 assets-cdn.github.com
185.199.108.153 assets-cdn.github.com
185.199.109.153 assets-cdn.github.com
185.199.111.153 assets-cdn.github.com
199.232.69.194 github.global.ssl.fastly.net
設置hosts
windows hosts 文件路徑: C:\Windows\System32\drivers\etc
通過記事本或編輯器打開 hosts 。沒有權限可以使用管理員打開,或復制出去修改了,復制回來覆蓋原文件。
直接添加上面的記錄
# 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.114.4 github.com 185.199.110.153 assets-cdn.github.com 185.199.108.153 assets-cdn.github.com 185.199.109.153 assets-cdn.github.com 185.199.111.153 assets-cdn.github.com 199.232.69.194 github.global.ssl.fastly.net
打開 cmd 刷新本地dns
ipconfig /flushdns
使用瀏覽器訪問
每次更新 hosts 過后好像不能立馬生效,測試都是等了好一會兒才可以,大概幾分鍾的樣子。
嘗試用 Google Chrome 訪問,一直訪問失敗,但是使用 Microsoft Edge 訪問成功了。或許和之前使用的一個軟件修改了谷歌瀏覽器的什么配置有關。
IP地址會變,如果不能訪問了,嘗試重新獲取IP地址,再修改。
快速訪問 GitHub
http://tool.chinaz.com/dns/ 查詢出來的地址是其他映射到 github 的地址
可以查詢出來過后通過 ping IP 的方式,看看哪一個響應比較快,然后把 hosts 里面 github.com 改到對應 IP
更詳細的解決方法、自動修改hosts...
參見 GitHub - 521xueweihan/GitHub520: 讓你“愛”上 GitHub,解決訪問時圖裂、加載慢的問題。(無需安裝)