gpt4 book ai didi

amazon-web-services - Ubuntu 18.04 上的 aws ec2 上的实例设置问题

转载 作者:行者123 更新时间:2023-12-04 19:27:44 27 4
gpt4 key购买 nike

在 aws ec2 上创建了一个实例,并且在初始设置之后一切正常。但过了一段时间(大约第二天),服务器似乎失去了与互联网的连接。我可以连接到它,但我无法下载任何数据包。我也无法执行任何 curl 请求。只有创建服务器镜像然后创建新配置才能解决问题,但第二天问题又出现了。知道如何解决问题吗?
创建实例时,网络设置被选为标准。 Ubuntu 18.04
示例输出:

apt update
Err:1 http://security.ubuntu.com/ubuntu bionic-security InRelease
Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1562::18). - connect (101: Network is unreachable) Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1562::15). - connect (101: Network is unreachable) Could not connect to security.ubuntu.com:80 (91.189.91.38), connection timed out Could not connect to security.ubuntu.com:80 (91.189.91.39), connection timed out
Err:2 http://eu-west-2.ec2.archive.ubuntu.com/ubuntu bionic InRelease
Could not connect to eu-west-2.ec2.archive.ubuntu.com:80 (54.229.225.193), connection timed out Could not connect to eu-west-2.ec2.archive.ubuntu.com:80 (54.246.214.20), connection timed out Could not connect to eu-west-2.ec2.archive.ubuntu.com:80 (34.253.229.19), connection timed out Could not connect to eu-west-2.ec2.archive.ubuntu.com:80 (34.241.117.189), connection timed out Could not connect to eu-west-2.ec2.archive.ubuntu.com:80 (54.229.116.227), connection timed out Could not connect to eu-west-2.ec2.archive.ubuntu.com:80 (34.253.189.82), connection timed out
Err:3 http://eu-west-2.ec2.archive.ubuntu.com/ubuntu bionic-updates InRelease
Unable to connect to eu-west-2.ec2.archive.ubuntu.com:http:
Err:4 http://eu-west-2.ec2.archive.ubuntu.com/ubuntu bionic-backports InRelease
Unable to connect to eu-west-2.ec2.archive.ubuntu.com:http:
Reading package lists... Done
Building dependency tree
Reading state information... Done
35 packages can be upgraded. Run 'apt list --upgradable' to see them.
W: Failed to fetch http://eu-west-2.ec2.archive.ubuntu.com/ubuntu/dists/bionic/InRelease Could not connect to eu-west-2.ec2.archive.ubuntu.com:80 (54.229.225.193), connection timed out Could not connect to eu-west-2.ec2.archive.ubuntu.com:80 (54.246.214.20), connection timed out Could not connect to eu-west-2.ec2.archive.ubuntu.com:80 (34.253.229.19), connection timed out Could not connect to eu-west-2.ec2.archive.ubuntu.com:80 (34.241.117.189), connection timed out Could not connect to eu-west-2.ec2.archive.ubuntu.com:80 (54.229.116.227), connection timed out Could not connect to eu-west-2.ec2.archive.ubuntu.com:80 (34.253.189.82), connection timed out
W: Failed to fetch http://eu-west-2.ec2.archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease Unable to connect to eu-west-2.ec2.archive.ubuntu.com:http:
W: Failed to fetch http://eu-west-2.ec2.archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease Unable to connect to eu-west-2.ec2.archive.ubuntu.com:http:
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1562::18). - connect (101: Network is unreachable) Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1562::15). - connect (101: Network is unreachable) Could not connect to security.ubuntu.com:80 (91.189.91.38), connection timed out Could not connect to security.ubuntu.com:80 (91.189.91.39), connection timed out
W: Some index files failed to download. They have been ignored, or old ones used instead.

最佳答案

该错误也可能与 DNS 有关,而与 Internet 连接无关。由于您通过 SSH 连接到虚拟机,因此虚拟机可以访问互联网吗?
我会更改 resolv.conf 中的 DNS 服务器。这样的事情会做:

echo > /etc/resolv.conf <<EOF
nameserver 1.0.0.1
nameserver 1.1.1.1
EOF
然后再试一次,看看它是否有效。

关于amazon-web-services - Ubuntu 18.04 上的 aws ec2 上的实例设置问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69553293/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com