debian12 解决 github 访问难的问题

可以在 /etc/hosts 文件中添加几个域名与IP对应关系,从而提高 github.com 的访问速度。

据搜索了解(不太确定),可以添加这几个域名:github.comgithub.global.ssl.fastly.netgithub.global.fastly.netassets-cdn.github.com,而且有意思的是我的 /etc/hosts 文件竟然默认有 github.comgithub.global.ssl.fastly.netassets-cdn.github.com 这三个被打上注释的域名,只是没有IP地址。

1. 如何查找这些域名的ip地址?

可以使用 https://sites.ipaddress.com 这个网址去查询,打开网址后,在如下的地方输入域名(以 github.com 为例)即可:

接着在当前网页就会查找出该域名的相关信息,包括域名基本信息,域名ip,ip服务器所在地址等信息。可以在这两个地方找到其IP地址:


这里找到的 github.com 域名IP为:140.82.113.3,同样的方法可以找到
github.global.ssl.fastly.net 域名IP为:151.101.1.194, 151.101.65.194, 151.101.129.194 和 151.101.193.194
github.global.fastly.net 域名IP为:151.101.0.204, 151.101.64.204, 151.101.128.204 和 151.101.192.204
assets-cdn.github.com 域名IP为:185.199.108.153, 185.199.109.153, 185.199.110.153 和 185.199.111.153
raw.githubusercontent.com 域名IP为:185.199.108.133, 185.199.109.133, 185.199.110.133 和 185.199.111.133

2.将域名与IP写入/etc/hosts文件

只需将下面的内容复制到/etc/hosts 文件中即可。

bash 复制代码
#github.com
140.82.113.3     github.com
#github.global.ssl.fastly.net
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
#github.global.fastly.net
151.101.0.204    github.global.fastly.net
151.101.64.204   github.global.fastly.net
151.101.128.204  github.global.fastly.net
151.101.192.204  github.global.fastly.net
#assets-cdn.github.com
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
#raw.githubusercontent.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

3. 使/etc/hosts 生效

输入下面的命令使/etc/hosts 生效

bash 复制代码
sudo systemctl restart NetworkManager
sudo systemctl restart networking

4.验证一下域名(能ping通就行)

bash 复制代码
ping github.com
ping github.global.ssl.fastly.net

5.体验 github

这时候在浏览器中打开github.com速度就快了。

相关推荐
好想来前端1 小时前
私有化部署 LLM 时,别再用 Nginx 硬扛流式请求了 —— 推荐一个专为 vLLM/TGI 设计的高性能网关
后端·架构·github
charlie1145141912 小时前
用 MkDocs + GitHub Actions 自动化部署项目文档
自动化·github
oMcLin3 小时前
如何在 Debian 11 上通过构建大数据湖,使用 Apache Spark 加速电商平台的数据分析与实时推荐引擎
spark·debian·apache
MemOS5 小时前
MemOS 产品更新|支持全量获取用户记忆,记忆管理与对话体验提升
github
恋猫de小郭5 小时前
Compose Multiplatform 1.10 Interop views 新特性:Overlay 和 Autosizing
android·flutter·macos·kotlin·github·objective-c·cocoa
·云扬·7 小时前
ClickHouse副本配置全攻略:基于ZooKeeper实现高可用部署
clickhouse·zookeeper·debian
极客小云7 小时前
【增强版 X-AnyLabeling:支持多模态图像对比标注与 YOLO 标签自动导入】
yolo·目标检测·github·语义分割
CoderJia程序员甲18 小时前
GitHub 热榜项目 - 日榜(2026-1-13)
人工智能·ai·大模型·github·ai教程
iuu_star21 小时前
项目开源-零基础掌握GitHub大文件上传(Git)
开源·github
wangruofeng1 天前
OpenCode 上手初体验:从安装到基础使用
github·ai编程