1

这个有什么解决办法??我试图从头开始设置新的 VPC。我在孟买地区创建了一个 CIDR 为 10.0.0.0/16 的 VPC。并创建了一个 Internet Gate 方式并附加到这些 VPC。创建了两个子网 1)10.0.1.0/24,有公共 IP,在可用区 US-East-1a 2)10.0.2.0/24 没有公共 IP,在可用区 US-East-1b 两个子网都在不同的区域

创建两个路由表 1.Route table1 与公共子网(10.0.1.0/24)并添加 Internet 网关。2.Route Table2 带私有子网(10.0.2.0/24) 不带互联网网关

修改了默认的 NETWORK ACL 以仅允许 HTTP、HTTPS、TELNET、SSH 的入站流量用于出站流量 -ALLOW ALL

我用 PUBLIC SUBNET(10.0.1.0/24) 启动了一个 EC2 实例,这些 EC2 实例有公共 IP 和私有 IP。和 EC2 安全组 INBOUND- HTTP、HTTPS、SSH 用于 0.0.0.0/0 出站 -ALL 用于 0.0.0.0/0

我能够登录到 ec2 控制台和 sudo -i 成为 sudo 用户

确认我能够正确连接到互联网

 ping 8.8.8.8
 PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
 64 bytes from 8.8.8.8: icmp_seq=1 ttl=56 time=1.27 ms
 64 bytes from 8.8.8.8: icmp_seq=2 ttl=56 time=1.39 ms
 64 bytes from 8.8.8.8: icmp_seq=3 ttl=56 time=1.43 ms
 ^C
 --- 8.8.8.8 ping statistics ---
 3 packets transmitted, 3 received, 0% packet loss, time 2003ms
 rtt min/avg/max/mdev = 1.270/1.366/1.438/0.082 ms

然后当我尝试执行 yum update -y 或尝试执行 yum install httpd

我收到以下错误

"# yum 更新 -y

 Loaded plugins: priorities, update-motd, upgrade-helper
 Could not retrieve mirrorlist http://repo.ap-south-1.amazonaws.com/latest/main/mirror.list error was
 12: Timeout on http://repo.ap-south-1.amazonaws.com/latest/main/mirror.list: (28, 
 'Resolving timed out after 5515 milliseconds')


 One of the configured repositories failed (Unknown),
 and yum doesn't have enough cached data to continue. At this point the only
 safe thing yum can do is fail. There are a few ways to work "fix" this:

 1. Contact the upstream for the repository and get them to fix the problem.

 2. Reconfigure the baseurl/etc. for the repository, to point to a working
    upstream. This is most often useful if you are using a newer
    distribution release than is supported by the repository (and the
    packages for the previous distribution release still work).

 3. Disable the repository, so yum won't use it by default. Yum will then
    just ignore the repository until you permanently enable it again or use
    --enablerepo for temporary usage:

        yum-config-manager --disable <repoid>

 4. Configure the failing repository to be skipped, if it is unavailable.
    Note that yum will try to contact the repo. when it runs most commands,
    so will have to try and fail each time (and thus. yum will be be much
    slower). If it is a very temporary problem though, this is often a nice
    compromise:

        yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true

当我使用公共 IP 启动实例并拥有 Internet 网关并为 ec2 实例级别和 VPC 级别打开 HTTP、HTTPS、SSH 端口时 - HTTP、HTTPS、SSH、TELENET 已为入站打开,仍然出现上述错误。?

4

2 回答 2

0

尝试执行yum repolist,看看repos是否可用,也可以提供“/etc/yum.repos.d/*”的配置文件,看看repo文件是否有错误。

于 2018-07-18T12:41:21.547 回答
0

我认为您必须为您的自定义 VPC 启用 DNS 解析,这可能会解决您的问题。

于 2018-07-25T08:13:01.383 回答