VPC内部路由

我在VPC上有两个子网,每个都有不同的AZ。 子网S1是公共的,子网S2是私有的。 我实现了两个EC2实例,每个实例都在自己的子网上。

/ AZ1 ====> S1 (10.0.1.x) =====> EC1 (10.0.1.1) VPC | \ AZ2 ====> S2 (10.0.2.x) =====> EC2 (10.0.2.2) 

那么,我使用SSH创build了一个到EC1的连接,一切正常,但是如果我尝试从EC1(10.0.1.1)ping到EC2(10.0.2.2),我得到这个:

 ec2-user@ec1 ~# ping 10.0.2.2 PING 10.0.2.2 (10.0.2.2) 56(84) bytes of data. From 10.0.1.1 icmp_seq=1 Destination Host Unreachable From 10.0.1.1 icmp_seq=2 Destination Host Unreachable From 10.0.1.1 icmp_seq=3 Destination Host Unreachable 

会有什么问题?

这些是configuration:

EC1计算机的路由表是:

 ec2-user@ec1 ~# route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface default ip-10-0-1-1.ec2 0.0.0.0 UG 0 0 0 eth0 10.0.1.0 * 255.255.255.0 U 0 0 0 eth0 10.0.2.0 * 255.255.255.0 U 0 0 0 eth0 

公有子网S1的路由表为:

 Destination Target Status Propagated 10.0.0.0/16 local Active No 0.0.0.0/0 igw-xxxxxx Active No 

私有子网S2的路由表为:

 Destination Target Status Propagated 10.0.0.0/16 local Active No 

ALL Traffic都打开networkingACL

编辑:安全组适用于计算机“EC2”

 Inbound Type Protocol Port Range Source All traffic All All 10.0.0.0/16 

我发现了这个问题。 10.0.2.x的网关是错误的。 我修复它,它的工作。

 ec2-user@ec1 ~# route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface default ip-10-0-1-1.ec2 0.0.0.0 UG 0 0 0 eth0 10.0.1.0 * 255.255.255.0 U 0 0 0 eth0 10.0.2.0 ip-10-0-1-1.ec2 255.255.255.0 U 0 0 0 eth0