如何从亚马逊VPC连接到外面的世界?亚马逊、连接到、世界、VPC

2023-09-11 23:39:46 作者:风中凌乱。

我有亚马逊VPC通过设置向导,如公共唯一的网络,所以我所有的情况下都在公共子网。

I have amazon VPC set through wizard as "public only network", so all my instances are in public subnet.

在VPC实例具有弹性IP分配连接到互联网,而无需任何麻烦。

Instances within VPC that have Elastic IP assigned connect to internet without any troubles.

但是,如果没有弹性IP情况下无法连接的任何地方。

But instances without elastic IP can't connect anywhere.

Internet网关是present。在AWS路由表中的控制台看上去像

Internet gateway is present. Route table in aws console looks like

Destination Target 
10.0.0.0/16 local
0.0.0.0/0   igw-nnnnn

和来自内部的实例显示路线

and route from inside instance shows

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.0.0.0        *               255.255.255.0   U     0      0        0 eth0
default         10.0.0.1        0.0.0.0         UG    100    0        0 eth0

我试图在一个实例属于安全组打开所有入站和出站流量0.0.0.0/0。仍然没有成功。

I tried to open ALL inbound and outbound traffic to 0.0.0.0/0 in security group that an instance belongs to. Still no success.

~$ ping google.com
PING google.com (74.125.224.36) 56(84) bytes of data.
^C
--- google.com ping statistics ---
6 packets transmitted, 0 received, 100% packet loss, time 5017ms

我还能做什么?

What else can I do?

推荐答案

看来,只有这样,才能从没有弹性IP情况下得到外界的是:

It appears that the only way to get outside from instances that don't have Elastic IP is:

添加NAT(从启动AMI-VPC-NAT-β额外的m1.small实例),并指定EIP它 创建一个额外的子网,这将是私人 将非EIP-实例私人子网 修改路由表:从专用子网0.0.0.0/0应到NAT

因此​​,只需添加NAT是不够的。实例应停药并转移到来自另一个子网的其他IP。

So, just adding NAT is not enough. Instances should be stopped and moved to another IP from another subnet.