解决Github等网站因DNS无法访问的问题

Github520(推荐)

https://github.com/521xueweihan/GitHub520

提供的hosts配置

https://raw.hellogithub.com/hosts

这个直接提供了Github的IP映射,会自动更新,强烈建议使用。

IP获取网站

IPAddress.com:

https://www.ipaddress.com/

Github无法访问

我们可以使用IPAddress.com来查找可用IP。

IPAddress.com:

https://www.ipaddress.com/

输入我们的的域名

1
raw.githubusercontent.com

或者直接访问以下地址

https://sites.ipaddress.com/github.com/

https://sites.ipaddress.com/github.global.ssl.fastly.net/

https://sites.ipaddress.com/assets-cdn.github.com/

https://sites.ipaddress.com/raw.githubusercontent.com/

https://sites.ipaddress.com/github.githubassets.com/

找到

image-20240415162323668

找到hosts文件

1
C:\Windows\System32\drivers\etc

添加如下映射

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
140.82.114.4     github.com
151.101.1.194 github.global.ssl.fastly.net
151.101.65.194 github.global.ssl.fastly.net
151.101.129.194 github.global.ssl.fastly.net
151.101.193.194 github.global.ssl.fastly.net
185.199.108.153 assets-cdn.github.com
185.199.109.153 assets-cdn.github.com
185.199.110.153 assets-cdn.github.com
185.199.111.153 assets-cdn.github.com
185.199.108.133 raw.githubusercontent.com
185.199.109.133 raw.githubusercontent.com
185.199.110.133 raw.githubusercontent.com
185.199.111.133 raw.githubusercontent.com
185.199.108.154 github.githubassets.com
185.199.109.154 github.githubassets.com
185.199.110.154 github.githubassets.com
185.199.111.154 github.githubassets.com

刷新DNS

大部分情况下是直接生效,如未生效可尝试下面的办法,刷新 DNS:

Windows:在 CMD 窗口输入:

1
ipconfig /flushdns

Linux 命令:

1
sudo rcnscd restart

Mac 命令:

1
sudo killall -HUP mDNSResponder

Hosts文件位置

hosts 文件在每个系统的位置不一,详情如下:

  • Windows 系统:C:\Windows\System32\drivers\etc\hosts
  • Linux 系统:/etc/hosts
  • Mac(苹果电脑)系统:/etc/hosts
  • Android(安卓)系统:/system/etc/hosts
  • iPhone(iOS)系统:/etc/hosts

暗黑4战网登录

更新于2024年3月31日

战网的DNS已经被污染了,所以我们无法登录。

网上的做法大都是开加速器,但是这不但收费,而且不一定稳定。

但是有加速器还是可以用加速器,好处在于降低延迟。

打开这个目录

1
C:\Windows\System32\drivers\etc

打开hosts文件

添加如下一行

1
2
3
4
59.153.40.90 prod.actual.battle.net
137.221.104.184 us.actual.battle.net
59.153.40.104 kr.actual.battle.net
37.244.16.152 eu.actual.battle.net

其中prod.actual.battle.net可改为

1
137.221.104.122 prod.actual.battle.net

1
137.221.104.184 prod.actual.battle.net

可以试试不同的地址看看哪个延迟更低更流畅。

这样不用开加速器也可以正常登录了。

验证是否生效

1
ping prod.actual.battle.net

或者

1
nslookup prod.actual.battle.net

另外要注意

如果使用XGP游玩的,关联战网后,不要用XBOX客户端打开,不打开Xbox直接使用战网打开运行,否则各种问题。