在 Ubuntu 16.04 上运行 sudo apt-get update 时出现“101:网络不可达”错误

在 Ubuntu 16.04 上运行 sudo apt-get update 时出现“101:网络不可达”错误

我启动了一个 EC2 Ubuntu 16.04 服务器。它包含在连接到私有 VPN 的 VPC 中。要通过 SSH 进入服务器,您必须先连接到该 VPN(该 VPN 也位于 AWS 上),然后才能访问服务器。设置好一切并开始配置服务器后,我发现没有sudo apt-get update安装任何更新,并收到以下错误:

ubuntu@private-ip:~$ sudo apt-get update
Err:1 http://eu-west-1.ec2.archive.ubuntu.com/ubuntu xenial InRelease Could not connect to eu-west-1.ec2.archive.ubuntu.com:80 (IP), connection timed out [IP]
Err:2 http://eu-west-1.ec2.archive.ubuntu.com/ubuntu xenial-updates InRelease Unable to connect to eu-west-1.ec2.archive.ubuntu.com:http: [IP]
Err:3 http://eu-west-1.ec2.archive.ubuntu.com/ubuntu xenial-backports InRelease Unable to connect to eu-west-1.ec2.archive.ubuntu.com:http: [IP]
Err:4 http://security.ubuntu.com/ubuntu xenial-security InRelease Cannot initiate the connection to security.ubuntu.com:80 (). - connect (101: Network is unreachable) [IP]
Reading package lists...
Done
W: Failed to fetch http://eu-west-1.ec2.archive.ubuntu.com/ubuntu/dists/xenial/InRelease Could not connect to eu-west-1.ec2.archive.ubuntu.com:80 (IP), connection timed out [IP] W: Failed to fetch http://eu-west-1.ec2.archive.ubuntu.com/ubuntu/dists/xenial-updates/InRelease Unable to connect to eu-west-1.ec2.archive.ubuntu.com:http: [IP]
W: Failed to fetch http://eu-west-1.ec2.archive.ubuntu.com/ubuntu/dists/xenial-backports/InRelease Unable to connect to eu-west-1.ec2.archive.ubuntu.com:http: [IP]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/xenial-security/InRelease Cannot initiate the connection to security.ubuntu.com:80 (). - connect (101: Network is unreachable) [IP]
W: Some index files failed to download. They have been ignored, or old ones used instead.

我也尝试安装 Apache,但出现了类似的错误。请问可能是什么问题?

答案1

我也遇到了同样的问题。

请按如下方式编辑 EC-2 实例安全组的出站规则。

类型 协议 端口范围 目标 描述

HTTP TCP 80 自定义 ::/0 NA

HTTP TCP 80 自定义 0.0.0.0/0 不适用

相关内容