允许 Amazon VPC A 访问 VPC B 上的新私有子网?

Allowing Amazon VPC A to get to a new private subnet on VPC B?

我有一个现有的 VPC (vpcA),并且最近设置了一个新的 VPC (vpcB),同时包含私有子网 (privateSubnet) 和 public 子网(publicSubnet)。我想允许从 vpcAvpcB 的连接。

vpcB 设置了堡垒服务器以允许来自 publicSubnetprivateSubnet 的 ssh - 这有效所以我知道 ssh 设置正确......所以开始我想我会尝试允许从 vpcAvpcB 上的 privateSubnet 的 ssh 连接。

我已经设置了一个 Peer Connection,并且我已经按照 resolving VPC peer network connectivity issues 上亚马逊的故障排除指南中的所有说明进行操作。连接处于活动状态,我设置了从 vpcA 到路由 10.0.1.0/24 到专用网络(专用地址是 10.0.1.10)的路由,ACL 策略似乎允许端口 22 上的所有流量(对于现在),并且安全组允许访问端口 22(现在再次)。当前实例本身没有配置防火墙规则,但是当我尝试通过 ssh 从 vpcA 上的实例连接时,我得到的是:

$ ssh -vvv 10.0.1.10
OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 10.0.1.10 [10.0.1.10] port 22.
debug2: fd 3 setting O_NONBLOCK
debug1: connect to address 10.0.1.10 port 22: Connection timed out
ssh: connect to host 10.0.1.10 port 22: Connection timed out

traceroute 给我这个:

traceroute to 10.0.1.10 (10.0.1.10), 30 hops max, 60 byte packets
1  * * *
2  * * *
... [same up to 30]
vpcBpublicSubnet 的堡垒服务器到 vpcB 上的 privateSubnet

ssh 工作正常所以我知道 ssh 本身正在实例本身上工作。但显然流量没有通过 VPC 对等连接。

我意识到故障排除可能需要比我目前提供的更多的细节,但是有人有这个设置吗?关于下一步要看的地方或我可以提供哪些配置来提示我们问题出在哪里的任何建议?

谢谢!

您的 traceroute 输出表明,没有转发您的请求的路由。

  • 确保您的 vpcA 和 vpcB 的 CIDR 不重叠
  • 检查私有子网的路由 table 和 vpcA 中的 public 子网是否有将流量路由到 vpcB 的条目。
  • public 和私人有一个单独的路由 table。
  • 路由 10.0.1.0/24 的目标应该是 VPC 对等连接 - 以 pcx-
  • 开头
  • VPC 对等连接是否已批准并处于活动状态?
  • 如果没有效果,post 子网路由的屏幕截图 tables

helloV 提到的所有内容都需要涵盖,因为这里有很多地方可能出错。但是,我的具体情况是我有从 vpcA 路由到 vpcB 的条目,但没有路由 return 从 vpcB 到 vpcA 的流量。

Amazon documentation on routing tables for VPC Peering 在这句话中暗示了这种需要:

To enable the routing of traffic between VPCs in a VPC peering connection, you must add a route to one or more of your VPC route tables that points to the VPC peering connection to access all or part of the CIDR block of the other VPC in the peering connection. Similarly, the owner of the other VPC must add a route to their VPC route table to route traffic back to your VPC.

这里的最后一句话是关键 - 提到的例子突出了这个问题。老实说,一开始我对此有点困惑,但 this explanation which refers to overlapping CIDR blocks in routes 也阐明了为什么需要这条路线:

AWS currently does not support unicast reverse path forwarding in VPC peering connections that checks the source IP of packets and routes reply packets back to the source.

总的来说 follow this advice 和 helloV 中的建议 post。但请记住,这些路由需要在相关子网之间是双向的,以便您让数据包双向流动。