VPC Peering configuration having a specific route

https://docs.aws.amazon.com/zh_cn/vpc/latest/peering/peering-configurations-partial-access.html

You can configure the VPC peer to peer connection to other parts CIDR blocks access to specific CIDR blocks (if there are multiple VPC CIDR blocks) or specific instances within the VPC. In these examples, a central VPC having two or more overlapping VPC to CIDR block, and the like. On the possible need for specific programs such as VPC example of the configuration of connections, see VPC peer programs . For more information about creating and using VPC peer connection, see use VPC peer connection . For more information about updating the routing table, see update routing tables VPC peer connections .

Two VPC subnets with two peers in a VPC

You have a center VPC (VPC A), having a peer to peer connection between VPC VPC A and B VPC ( pcx-aaaabbbb), and has a peer to peer connection between VPC VPC A and C VPC ( pcx-aaaacccc). A subnet with two VPC: each respective VPC a peer to peer connection.


                    Two VPC subnets and two peer

When your center VPC has a separate set of resources in a different subnet, you may need to use this type of configuration. Other VPC may need access to some resources, but not all resources.

X subnet routing table points to peer connections VPC pcx-aaaabbbbentire VPC CIDR blocks to access B's. VPC B points to routing table pcx-aaaabbbbto access only CIDR blocks the VPC A subnet X. Similarly, the subnet routing table points to Y VPC peer connection pcx-aaaaccccbased on the entire VPC CIDR block access of C. VPC C points to routing table pcx-aaaaccccto access only CIDR blocks of Y VPC A subnet.

Routing Table destination aims
VPC A subnet X 172.16.0.0/16 local
10.0.0.0/16 pcx-aaaabbbb
VPC A subnet Y 172.16.0.0/16 local
10.0.0.0/16 pcx-aaaacccc
VPC B 10.0.0.0/16 local
172.16.0.0/24 pcx-aaaabbbb
VPC C 10.0.0.0/16 local
172.16.1.0/24 pcx-aaaacccc

Similarly, the center VPC (VPC A) can have multiple CIDR blocks and VPC B and C may have VPC VPC peer to peer connection with each subnet CIDR block.


    			VPC CIDR blocks with a two peer
Routing Table destination aims
VPC A subnet X 10.2.0.0/16 local
10.3.0.0/16 local
10.0.0.0/16 pcx-aaaabbbb
VPC A subnet Y 10.2.0.0/16 local
10.3.0.0/16 local
10.0.0.0/16 pcx-aaaacccc
VPC B 10.0.0.0/16 local
10.2.0.0/24 pcx-aaaabbbb
VPC C 10.0.0.0/16 local
10.3.0.0/24 pcx-aaaacccc

For more information, please refer to the Amazon VPC User Guide in adding IPv4 CIDR block to the VPC .

Two two subnets and peer VPC VPC for IPv6 in

Your VPC peer configuration as shown above. A VPC is enabled and the IPv6 communication VPC B - has an associated two IPv6 VPC CIDR block, VPC A subnet has an associated X IPv6 CIDR block.


                        Two VPC subnets and two peer

You can make the connection through VPC B X A VPC subnetworks with IPv6 uses peer VPC. To do this, for the VPC A routing table to add a certain route IPv6 CIDR block VPC B and add a target VPC B routing table to route IPv6 CIDR block X of VPC A subnet.

Routing Table destination aims Remark
VPC A subnet X 172.16.0.0/16 local  
2001:db8:abcd:aa00::/56 本地 VPC 中自动添加的用于 IPv6 通信的本地路由。
10.0.0.0/16 pcx-aaaabbbb  
2001:db8:1234:bb00::/56 pcx-aaaabbbb 到 VPC B 的 IPv6 CIDR 块的路由。
VPC A 中的子网 Y 172.16.0.0/16 本地  
2001:db8:abcd:aa00::/56 本地 VPC 中自动添加的用于 IPv6 通信的本地路由。
10.0.0.0/16 pcx-aaaacccc  
VPC B 10.0.0.0/16 本地  
2001:db8:1234:bb00::/56 本地 VPC 中自动添加的用于 IPv6 通信的本地路由。
172.16.0.0/24 pcx-aaaabbbb  
2001:db8:abcd:aa00::/64 pcx-aaaabbbb 到 VPC A 的 IPv6 CIDR 块的路由。
VPC C 10.0.0.0/16 本地  
172.16.1.0/24 pcx-aaaacccc  

两个 VPC 与一个 VPC 中的特定 CIDR 块对等

您有一个中心 VPC (VPC A),在 VPC A 与 VPC B 之间具有 VPC 对等连接 (pcx-aaaabbbb),并且在 VPC A 与 VPC C 之间具有 VPC 对等连接 (pcx-aaaacccc)。VPC A 具有两个 CIDR 块,每个 VPC 对等连接各一个。

路由表 目的地 目标 备注
VPC A 中的子网 X 172.16.0.0/16 本地  
2001:db8:abcd:aa00::/56 本地 VPC 中自动添加的用于 IPv6 通信的本地路由。
10.0.0.0/16 pcx-aaaabbbb  
2001:db8:1234:bb00::/56 pcx-aaaabbbb 到 VPC B 的 IPv6 CIDR 块的路由。
VPC A 中的子网 Y 172.16.0.0/16 本地  
2001:db8:abcd:aa00::/56 本地 VPC 中自动添加的用于 IPv6 通信的本地路由。
10.0.0.0/16 pcx-aaaacccc  
VPC B 10.0.0.0/16 本地  
2001:db8:1234:bb00::/56 本地 VPC 中自动添加的用于 IPv6 通信的本地路由。
172.16.0.0/24 pcx-aaaabbbb  
2001:db8:abcd:aa00::/64 pcx-aaaabbbb 到 VPC A 的 IPv6 CIDR 块的路由。
VPC C 10.0.0.0/16 本地  
172.16.1.0/24 pcx-aaaacccc  

有关更多信息,请参阅 Amazon VPC 用户指南 中的向 VPC 中添加 IPv4 CIDR 块

一个 VPC 与两个 VPC 中的特定子网对等

您有带一个子网的中心 VPC (VPC A),在 VPC A 与 VPC B 之间具有 VPC 对等连接 (pcx-aaaabbbb),并且在 VPC A 与 VPC C 之间具有 VPC 对等连接 (pcx-aaaacccc)。VPC B 和 VPC C 各自具有两个子网,每个 VPC 中只有一个子网用于与 VPC A 的对等连接。


          VPC has a peer relationship with the two subnets

当您在中心 VPC 上具有单个资源集 (如 Active Directory 服务) 时,可能需要使用这种类型的配置。中心 VPC 无需可完全访问与之对等的 VPC。

VPC A 的路由表同时指向两个 VPC 对等连接以便仅访问 VPC B 和 VPC C 中的特定子网。VPC B 和 VPC C 中子网的路由表指向其 VPC 对等连接以访问 VPC A 的子网。

路由表 目的地 目标
VPC A 172.16.0.0/16 本地
10.0.0.0/24 pcx-aaaabbbb
10.0.1.0/24 pcx-aaaacccc
VPC B 中的子网 A 10.0.0.0/16 本地
172.16.0.0/24 pcx-aaaabbbb
VPC C 中的子网 B 10.0.0.0/16 本地
172.16.0.0/24 pcx-aaaacccc

响应流量路由

如果您的某个 VPC 与多个具有重叠或匹配的 CIDR 块的 VPC 对等,请确保路由表配置为不从您的 VPC 向不正确的 VPC 发送响应流量。AWS 当前不支持在 VPC 对等连接中进行单一地址反向传输路径转发,即检查数据包的源 IP 并将应答数据包路由回源。

例如,VPC A 与 VPC B 和 VPC C 具有对等关系。VPC B 和 VPC C 具有匹配 CIDR 块,并且其子网具有匹配 CIDR 块。VPC B 中子网 B 的路由表指向 VPC 对等连接 pcx-aaaabbbb 以访问 VPC A 的子网。VPC A 的路由表配置为将 10.0.0.0/16 流量发送到对等连接 pcx-aaaaccccc

路由表 目的地 目标
VPC B 中的子网 B 10.0.0.0/16 本地
172.16.0.0/24 pcx-aaaabbbb
VPC A 172.16.0.0/24 本地
10.0.0.0/16 pcx-aaaacccc

            Peer does not respond correctly routed

VPC B 的子网 B 中私有 IP 地址为 10.0.1.66/32 的实例使用 VPC 对等连接 pcx-aaaabbbb 向 Active Directory 服务器发送流量。VPC A 向 10.0.1.66/32 发送响应流量。但 VPC A 路由表配置为将 10.0.0.0/16 IP 地址范围中的所有流量都发送到 VPC 对等连接 pcx-aaaacccc。如果 VPC C 中的子网 B 具有 IP 地址为 10.0.1.66/32 的实例,则它从 VPC A 接收响应流量。VPC B 中子网 B 内的实例不接收对其到 VPC A 的请求的响应。

为了防止这种情况,您可以将某个特定路由添加到 VPC A 的路由表,其目的地为 10.0.1.0/24,目标为 pcx-aaaabbbb10.0.1.0/24 流量的路由更明确,因此,前往 10.0.1.0/24 IP 地址范围的流量将通过 VPC 对等连接 pcx-aaaabbbb 流动

或者,在以下示例中,VPC A 的路由表针对每个 VPC 对等连接具有每个子网的路由。VPC A 可以与 VPC B 中的子网 B 以及 VPC C 中的子网 A 进行通信。如果您需要添加与位于 10.0.0.0/16 IP 地址范围内的另一子网的其他 VPC 对等连接,则此情况非常有用,您只需为该特定子网添加其他路由即可。

目的地 目标
172.16.0.0/16 本地
10.0.1.0/24 pcx-aaaabbbb
10.0.0.0/24 pcx-aaaacccc

或者,根据您的使用案例,您可以创建到 VPC B 中特定 IP 地址的路由,确保将流量路由回正确的服务器 (路由表使用最长前缀匹配来确定路由的优先级):

目的地 目标
172.16.0.0/16 本地
10.0.1.66/32 pcx-aaaabbbb
10.0.0.0/16 pcx-aaaacccc

一个 VPC 中的实例与两个 VPC 中的实例对等

您有带一个子网的中心 VPC (VPC A),在 VPC A 与 VPC B 之间具有 VPC 对等连接 (pcx-aaaabbbb),并且在 VPC A 与 VPC C 之间具有 VPC 对等连接 (pcx-aaaacccc)。VPC A 的一个子网具有多个实例;其对等的每个 VPC 各一个。您可能需要使用这种类型的配置将对等流量限制到特定实例。


                    Examples of a VPC in Example VPC two peer

每个 VPC 的路由表都指向相关 VPC 对等连接,以访问对等 VPC 中的单个 IP 地址 (因而访问特定实例)。

路由表 目的地 目标
VPC A 172.16.0.0/16 本地
10.0.0.44/32 pcx-aaaabbbb
10.0.0.55/32 pcx-aaaacccc
VPC B 10.0.0.0/16 本地
172.16.0.88/32 pcx-aaaabbbb
VPC C 10.0.0.0/16 本地
172.16.0.99/32 pcx-aaaacccc

一个 VPC 与使用最长前缀匹配的两个 VPC 具有对等关系

您有带一个子网的中心 VPC (VPC A),在 VPC A 与 VPC B 之间具有 VPC 对等连接 (pcx-aaaabbbb),并且在 VPC A 与 VPC C 之间具有 VPC 对等连接 (pcx-aaaacccc)。VPC B 和 VPC C 具有匹配 CIDR 块。您要使用 VPC 对等连接 pcx-aaaabbbb 在 VPC A 与 VPC B 中特定实例之间路由流量。以 10.0.0.0/16 IP 地址范围为目标的所有其他流量都通过 pcx-aaaacccc 在 VPC A 与 VPC C 之间路由。


                    The longest prefix match peer

VPC 路由表使用最长前缀匹配选择跨预期 VPC 对等连接的最具体路由。所有其他流量都通过下一个匹配路由 (在此例中,跨 VPC 对等连接 pcx-aaaacccc) 进行路由。

路由表 目的地 目标
VPC A 172.16.0.0/16 本地
10.0.0.77/32 pcx-aaaabbbb
10.0.0.0/16 pcx-aaaacccc
VPC B 10.0.0.0/16 本地
172.16.0.0/16 pcx-aaaabbbb
VPC C 10.0.0.0/16 本地
172.16.0.0/16 pcx-aaaacccc

重要

如果 VPC B 中除 10.0.0.77/32 之外的实例向 VPC A 发送流量,则响应流量可能会路由到 VPC C,而不是 VPC B。有关更多信息,请参阅响应流量路由

多 VPC 配置

在此示例中,一个中心 VPC (VPC A) 采用轮辐型配置与多个 VPC 对等。有关此类型的配置的更多信息,请参阅一个 VPC 与多个 VPC 具有对等关系。您还具有采用完全网状配置相互对等的三个 VPC (VPC M、N 和 P)。有关此类型的配置的更多信息,请参阅相互对等的三个 VPC

VPC C 还具有与 VPC M 之间的 VPC 对等连接 (pcx-ccccmmmm)。VPC A 和 VPC M 具有重叠 CIDR 块。这意味着 VPC A 与 VPC C 之间的对等流量限制到 VPC C 中的特定子网(子网 A)。这样是为了确保如果 VPC C 从 VPC A 或 VPC M 接收请求,则它会将响应流量发送到正确的 VPC。AWS 当前不支持在 VPC 对等连接中进行单一地址反向传输路径转发,即检查数据包的源 IP 并将应答数据包路由回该源。有关更多信息,请参阅 响应流量路由

同样,VPC C 和 VPC P 具有重叠 CIDR 块。VPC M 与 VPC C 之间的对等流量限制到 VPC C 中的子网 B,VPC M 与 VPC P 之间的对等流量限制到 VPC P 中的子网 A。这样是为了确保如果 VPC M 从 VPC C 或 VPC P 接收对等流量,则它会将响应流量发送回正确的 VPC。


                    Multi-peer configuration

VPC B、D、E、F 和 G 的路由表指向相关对等连接以访问 VPC A 的完整 CIDR 块,VPC A 的路由表指向 VPC B、D、E、F 和 G 的相关对等连接以访问其完整 CIDR 块。对于对等连接 pcx-aaaacccc,VPC A 的路由表仅将流量路由到 VPC C 中的子网 A (192.168.0.0/24),VPC C 中子网 A 的路由表指向 VPC A 的完整 CIDR 块。

VPC N 的路由表指向相关对等连接以访问 VPC M 和 VPC P 的完整 CIDR 块,VPC P 的路由表指向相关对等连接以访问 VPC N 的完整 CIDR 块。VPC P 中子网 A 的路由表指向相关对等连接以访问 VPC M 的完整 CIDR 块。VPC M 的路由表指向相关对等连接以访问 VPC C 中的子网 B 和 VPC P 中的子网 A。

路由表 目的地 目标
VPC A 172.16.0.0/16 local
10.0.0.0/16 pcx-aaaabbbb
192.168.0.0/24 pcx-aaaacccc
10.2.0.0/16 pcx-aaaadddd
10.3.0.0/16 pcx-aaaaeeee
172.17.0.0/16 pcx-aaaaffff
10.4.0.0/16 pcx-aaaagggg
VPC B 10.0.0.0/16 local
172.16.0.0/16 pcx-aaaabbbb
A VPC C subnets 192.168.0.0/16 local
172.16.0.0/16 pcx-aaaacccc
VPC C subnet B 192.168.0.0/16 local
172.16.0.0/16 pcx-ccccmmmm
VPC D 10.2.0.0/16 local
172.16.0.0/16 pcx-aaaadddd
VPC E 10.3.0.0/16 local
172.16.0.0/16 pcx-aaaaeeee
VPC F 172.17.0.0/16 local
172.16.0.0/16 pcx-aaaaaffff
VPC G 10.4.0.0/16 local
172.16.0.0/16 pcx-aaaagggg
VPC M 172.16.0.0/16 local
192.168.1.0/24 pcx-ccccmmmm
10.0.0.0/16 pcx-mmmmnnnn
192.168.0.0/24 pcx-mmmmpppp
VPC N 10.0.0.0/16 local
172.16.0.0/16 pcx-mmmmnnnn
192.168.0.0/16 pcx-nnnnpppp
VPC P 192.168.0.0/16 local
10.0.0.0/16 pcx-nnnnpppp
172.16.0.0/16 pcx-mmmmpppp

Guess you like

Origin www.cnblogs.com/cloudrivers/p/11334460.html