Loading... # 让纯 IPv6 小鸡也能访问 GitHub:一行 hosts 搞定 玩 VPS 的朋友应该都遇到过:纯 IPv6 的小鸡(VPS 只分配 IPv6 地址),访问 GitHub 经常失败或超时。原因不是没有 IPv6 线路,而是 **GitHub 早就提供了 IPv6 地址,却一直没有把它们加入 DNS 解析**。 一位 NodeSeek 网友在安装需要访问 GitHub 的工具时发现了这个问题,并从 [danwin1210.de 的 GitHub IPv6 代理总结页](https://danwin1210.de/github-ipv6-proxy.php) 找到了 GitHub 官方已启用、但未公布在 DNS 里的 IPv6 地址。解决办法非常简单:把这些地址写进 `/etc/hosts`,强制走 IPv6 直连。 ## 使用方法 将以下内容追加到 `/etc/hosts`: ``` 2a01:4f8:c010:d56::2 github.com 2a01:4f8:c010:d56::3 api.github.com 2a01:4f8:c010:d56::4 codeload.github.com 2a01:4f8:c010:d56::6 ghcr.io 2a01:4f8:c010:d56::7 pkg.github.com npm.pkg.github.com maven.pkg.github.com nuget.pkg.github.com rubygems.pkg.github.com 2a01:4f8:c010:d56::8 uploads.github.com 2606:50c0:8000::133 objects.githubusercontent.com www.objects.githubusercontent.com release-assets.githubusercontent.com gist.githubusercontent.com repository-images.githubusercontent.com camo.githubusercontent.com private-user-images.githubusercontent.com avatars0.githubusercontent.com avatars1.githubusercontent.com avatars2.githubusercontent.com avatars3.githubusercontent.com cloud.githubusercontent.com desktop.githubusercontent.com support.github.com 2606:50c0:8000::154 support-assets.githubassets.com github.githubassets.com opengraph.githubassets.com github-registry-files.githubusercontent.com github-cloud.githubusercontent.com ``` 加完之后,与 GitHub 相关的流量就会走上面的 IPv6 地址,此时正常 `git clone` 即可。 ## 补充:更多可用 IPv6 地址 帖子评论区的网友又补充了一批可用的 GitHub IPv6 地址,如果上面的地址在你的网络环境下不生效,可以换用这些: ``` 2001:67c:2f4c:2::225 2001:15e8:110:7d00::5c9 2001:1600:13:101::20d8 2001:1600:18:100::98 2407:3640:2281:426::1 2605:e440:1::1:c2 2605:e440:1::1:34d 2605:e440:1::2:19 2605:e440:7::378 2605:e440:37::2a8 2a00:b700:5::320 2a01:4f8:1c0c:53d9::1 2a01:4f8:1c0c:7851::1 2a01:7a7:2:3c16::f93c:f583 2a01:e5c0:475e::2 2a01:ecc0:200:498::2 2a02:6b40:2000:116d::1 2a03:90c0:94::bd 2a03:90c0:94:ffff::111 2a03:b0c0:3:d0::e9f:8001 2a05:541:121:21::1 2a05:d014:1c0:5d00:c7f4:dacf:56d5:7365 2a06:1301:4050:45:148:30:91:0 2a09:31c0:cafe::19 2a09:cd42:f:4329::1 2a0a:3840:8078:22:0:504e:16dc:1337 2a0a:4cc0:ff:805:8e1:e6ff:fe06:d336 2a0b:4141:820:c88::2 2a0c:16c0:515:82c::b98c 2a0d:5940:112:c8::a 2a0d:7c40:3000:8ac::2 2a0f:f01:205:31:: 2a0f:f01:205:143:: 2a0f:f01:206:62:: 2a0f:f01:207:495:: 2a0f:cdc6:500:21f::2 2a0f:cdc6:500:8dc::2 2a0f:cdc6:500:feb::2 2a0f:cdc6:500:18fb::2 2a0f:cdc6:500:1961::2 2a10:c943:100::89e 2a12:5940:a6eb::2 2a12:bec4:1bb0:24::2 2a12:bec4:1bb0:b46::2 2a13:7c00:6:24:f816:3eff:feea:90b8 2a13:d201:0:64::1 2a14:1e00:1:d4:: 2a14:1e00:1:f0e:: ``` ## 备选方案 评论区也有人提到:临时换一个 **DNS64 服务**的 DNS 也很方便——DNS64 会自动把 IPv4 域名映射成 IPv6 地址,纯 IPv6 环境下的解析问题它都能兜住。如果 hosts 方案对你不好使(比如想全局生效、不想维护列表),可以考虑这个思路。 ## 小结 核心就一句话:**GitHub 有 IPv6 地址,只是没进 DNS。** 手动把地址写进 `/etc/hosts`,纯 IPv6 小鸡就能正常 clone、拉包、用 ghcr 了。方法零依赖、零重启、改完即生效,适合那些只有 IPv6 的轻量服务器。 --- *本文改写自 NodeSeek 社区帖子《让纯IPV6小鸡也能使用GITHUB》,原文:https://www.nodeseek.com/post-531425-1* Last modification:August 12, 2026 © Allow specification reprint Like 如果觉得我的文章对你有用,请随意赞赏