一、在hosts文件中添加IP
1、訪問一下兩個網址
http://github.com.ipaddress.com/
https://fastly.net.ipaddress.com/github.global.ssl.fastly.net
獲取兩個IP地址;
2、打開本地host文件 C:\Windows\System32\drivers\etc
添加
# 訪問 github
140.82.114.3 github.com
199.232.69.194 github.global.ssl.fastly.net
這樣就能訪問了
3、更新DNS緩存
若還是不能訪問,打開CMD運行如下命令 ipconfig /flushdns 再試一下
二、如何修改hosts文件
右擊hosts點擊屬性-->安全
選擇高級
選擇更改權限
點擊添加
選擇主體
接下來以記事本的方式打開hosts方式來修改並保存hosts文件
三、hosts文件不見了該如何處理
輸入for /f %P in ('dir %windir%\WinSxS\hosts /b /s') do copy %P %windir%\System32\drivers\etc & echo %P & Notepad %P並運行就可以看到hosts文件了