

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 使用 AWS Transit Gateway Connect 扩展 VRFs 到 AWS
<a name="extend-vrfs-to-aws-by-using-aws-transit-gateway-connect"></a>

*Adam Till、Yashar Araghi、Vikas Dewangan 和 Amazon Web Services 的 Mohideen HajaMohideen*

## Summary
<a name="extend-vrfs-to-aws-by-using-aws-transit-gateway-connect-summary"></a>

虚拟路由转发（VRF）是传统网络的一个特征。它使用路由表形式的隔离逻辑路由域来分隔同一物理基础设施内的网络流量。当您将本地网络连接到 AWS 时，您可以配置 AWS Transit Gateway 以支持 VRF 隔离。此模式使用示例架构将本地 VRFs 连接到不同的公交网关路由表。

此模式使用 AWS Direct Connect 中的传输虚拟接口 (VIFs) 和传输网关 Connect 附件来扩展 VRFs。[中转 VIF](https://docs.aws.amazon.com/directconnect/latest/UserGuide/WorkingWithVirtualInterfaces.html) 用于访问与 Direct Connect 网关关联的一个或多个 Amazon VPC 中转网关。[中转网关 Connect 连接](https://docs.aws.amazon.com/vpc/latest/tgw/tgw-connect.html)将中转网关与在 VPC 中运行的第三方虚拟设备连接起来。中转网关 Connect 连接支持通用路由封装（GRE）隧道协议以实现高性能，支持边界网关协议（BGP）以实现动态路由。

此模式中描述的方法具有以下优点：
+ 使用 Transit Gateway Connect，您可以向 Transit Gateway Connect 对等方通告最多 1,000 条路由，并从中接收最多 5,000 条路由。在不使用 Transit Gateway Connect 的情况下使用 Direct Connect 中转 VIF 功能时，每个中转网关最多可使用 20 个前缀。
+ 无论您的客户使用何种 IP 地址架构，您都可以保持流量隔离并使用 Transit Gateway Connect 在 AWS 上提供托管服务。
+ VRF 流量不需要遍历公共虚拟接口。这使得许多组织更容易遵守合规性和安全要求。
+ 每个 GRE 隧道支持高达 5 Gbps，每个中转网关 Connect 连接最多可以有四个 GRE 隧道。这比许多其他连接类型都要快，例如支持高达 1.25 Gbps 的 AWS Site-to-Site VPN 连接。

## 先决条件和限制
<a name="extend-vrfs-to-aws-by-using-aws-transit-gateway-connect-prereqs"></a>

**先决条件**
+ 所需 Amazon Web Services account 已创建（有关详细信息，请参阅架构）
+ 在每个账户中代入 AWS Identity and Access Management (IAM) 角色。
+ 每个账户的 IAM 角色必须有权预调配 AWS Transit Gateway 和 AWS Direct Connect 资源。有关更多信息，请参阅[中转网关的身份验证和访问控制](https://docs.aws.amazon.com/vpc/latest/tgw/transit-gateway-authentication-access-control.html)和 [Direct Connect 的身份和访问管理](https://docs.aws.amazon.com/directconnect/latest/UserGuide/security-iam.html)。
+ Direct Connect 连接已成功创建。有关更多信息，请参阅[使用连接向导创建连接](https://docs.aws.amazon.com/directconnect/latest/UserGuide/dedicated_connection.html#create-connection)。

**限制**
+ 生产、质量保证和开发账户 VPCs 中的公交网关附件存在限制。有关更多信息，请参阅 [VPC 的中转网关连接](https://docs.aws.amazon.com/vpc/latest/tgw/tgw-vpc-attachments.html)。
+ 创建和使用 Direct Connect 网关是有限制的。有关更多信息，请参阅 [AWS Direct Connect 限额](https://docs.aws.amazon.com/directconnect/latest/UserGuide/limits.html)。

## 架构
<a name="extend-vrfs-to-aws-by-using-aws-transit-gateway-connect-architecture"></a>

**目标架构**

以下示例架构提供了一种可重复使用的解决方案，用于 VIFs 通过公交网关 Connect 附件部署公交。该架构通过使用多个 Direct Connect 位置来提供弹性。有关更多信息，请参阅 Direct Connect 文档中的[最大弹性](https://docs.aws.amazon.com/directconnect/latest/UserGuide/maximum_resiliency.html)。本地网络包含生产、质量保证和开发，这些内容扩展到 AWS VRFs ，并使用专用路由表进行隔离。

![使用 AWS Direct Connect 和 AWS Transit Gateway 资源进行扩展的架构图 VRFs](http://docs.aws.amazon.com/zh_cn/prescriptive-guidance/latest/patterns/images/pattern-img/db17e177-6c94-4d81-ab39-0923ecab2f1b/images/10be0625-8574-40eb-bc00-bb0a07d0dc26.png)


在 AWS 环境中，有两个账户专门用于扩展 VRFs：一个 *Direct Connect 账户*和一个*网络中心账户*。Direct Connect 账户包含每台路由器的连接和传输 VIFs 。您可以 VIFs 从 Direct Connect 账户创建传输，但将其部署到网络中心帐户，这样您就可以将它们与网络中心账户中的 Direct Connect 网关关关联。网络中心账户包含 Direct Connect 网关和中转网关。AWS 资源连接方式如下：

1. Transit 将直接 VIFs 连接地点的路由器与 Direct Connect 账户中的 AWS Direct Connect 连接起来。

1. 中转 VIF 将 Direct Connect 与网络中心账户中的 Direct Connect 网关连接。

1. [中转网关关联](https://docs.aws.amazon.com/directconnect/latest/UserGuide/direct-connect-transit-gateways.html)将 Direct Connect 网关与网络中心账户中的中转网关连接起来。

1. [Transit gateway Connect 附件](https://docs.aws.amazon.com/vpc/latest/tgw/tgw-connect.html)将公交网关与生产账户、QA 账户和开发账户连接起来。 VPCs 

*中转 VIF 架构*

下图显示了公交的配置详细信息 VIFs。此示例架构使用 VLAN 为隧道源，但您也可以使用环回。

![路由器与 AWS Direct Connect 间中转 VIF 连接的配置详细信息](http://docs.aws.amazon.com/zh_cn/prescriptive-guidance/latest/patterns/images/pattern-img/db17e177-6c94-4d81-ab39-0923ecab2f1b/images/e88d2546-61ef-4531-972b-089cdf44ed67.png)


以下是公交的配置详细信息，例如自治系统编号 (ASNs) VIFs。


| 
| 
| 资源 | Item | Detail | 
| --- |--- |--- |
| 路由器-01 | ASN | 65534 | 
| 路由器-02 | ASN | 65534 | 
| 路由器-03 | ASN | 65534 | 
| 路由器-04 | ASN | 65534 | 
| Direct Connect 网关 | ASN | 64601 | 
| Transit Gateway | ASN | 64600 | 
| CIDR 块 | 10.100.254.0/24 | 

*中转网关 Connect 架构*

下图和表格介绍了如何通过中转网关 Connect 连接配置单个 VRF。此外 VRFs，请在 CIDR 块内分配唯一的隧道 IDs、传输网关 GRE IP 地址和 BGP。对等 GRE IP 地址与中转 VIF 中的路由器对等 IP 地址相匹配。

![路由器和中转网关之间 GRE 隧道的配置详细信息](http://docs.aws.amazon.com/zh_cn/prescriptive-guidance/latest/patterns/images/pattern-img/db17e177-6c94-4d81-ab39-0923ecab2f1b/images/e58278e1-f3b4-442d-95d9-1dafab4aa5ac.png)


下表包含路由器配置详细信息。


| 
| 
| 路由器 | 隧道 | IP 地址 | 来源 | 目标位置 | 
| --- |--- |--- |--- |--- |
| 路由器-01 | 隧道 1 | 169.254.101.17 | VLAN 60<br />169.254.100.1 | 10.100.254.1 | 
| 路由器-02 | 隧道 11 | 169.254.101.81 | VLAN 61<br />169.254.100.5 | 10.100.254.11 | 
| 路由器-03 | 隧道 21 | 169.254.101.145 | VLAN 62<br />169.254.100.9 | 10.100.254.21 | 
| 路由器-04 | 隧道 31 | 169.254.101.209 | VLAN 63<br />169.254.100.13 | 10.100.254.31 | 

下表包含中转网关配置详细信息。


| 
| 
| 隧道 | 中转网关 GRE IP 地址 | 对等 GRE IP 地址 | CIDR 块内的 BGP | 
| --- |--- |--- |--- |
| 隧道 1 | 10.100.254.1 | VLAN 60<br />169.254.100.1 | 169.254.101.16/29 | 
| 隧道 11 | 10.100.254.11 | VLAN 61<br />169.254.100.5 | 169.254.101.80/29 | 
| 隧道 21 | 10.100.254.21 | VLAN 62<br />169.254.100.9 | 169.254.101.144/29 | 
| 隧道 31 | 10.100.254.31 | VLAN 63<br />169.254.100.13 | 169.254.101.208/29 | 

**部署**

[操作说明](#extend-vrfs-to-aws-by-using-aws-transit-gateway-connect-epics)部分介绍如何在多台客户路由器上部署****单个 VRF 的示例配置。步骤 1–5 完成后，您可使用步骤 6–7 为要扩展到 AWS 的每个新 VRF 创建新的中转网关 Connect 连接：

1. 创建中转网关。

1. 为每个 VRF 创建中转网关路由表。

1. 创建中转虚拟接口。

1. 创建 Direct Connect 网关。

1. 使用允许的前缀创建 Direct Connect 网关虚拟接口和网关关联。

1. 创建中转网关 Connect 连接。

1. 创建中转网关 Connect 对等节点。

1. 将中转网关 Connect 连接与路由表相关联。

1. 向路由器传播路由。

## 工具
<a name="extend-vrfs-to-aws-by-using-aws-transit-gateway-connect-tools"></a>

**Amazon Web Services**
+ [AWS Direct Connect](https://docs.aws.amazon.com/directconnect/latest/UserGuide/Welcome.html) 通过标准的以太网光纤电缆将内部网络链接到 Direct Connect 位置。通过此连接，您可以直接创建连接到公有 Amazon Web Services 的虚拟接口，同时绕过网络路径中的互联网服务提供商。
+ [AWS Transit Gateway](https://docs.aws.amazon.com/vpc/latest/tgw/what-is-transit-gateway.html) 是一个连接虚拟私有云 (VPCs) 和本地网络的中心枢纽。
+ [Amazon Virtual Private Cloud（Amazon VPC）](https://docs.aws.amazon.com/vpc/latest/userguide/what-is-amazon-vpc.html)可帮助您将 AWS 资源启动到您定义的虚拟网络中。此虚拟网络类似于您在自己的数据中心内运行的传统网络，具有使用 AWS 可扩展基础设施的优势。

## 操作说明
<a name="extend-vrfs-to-aws-by-using-aws-transit-gateway-connect-epics"></a>

### 规划架构
<a name="plan-the-architecture"></a>


| Task | 说明 | 所需技能 | 
| --- | --- | --- | 
| 创建自定义架构图。 | [See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_cn/prescriptive-guidance/latest/patterns/extend-vrfs-to-aws-by-using-aws-transit-gateway-connect.html) | 云架构师、网络管理员 | 

### 创建中转网关资源
<a name="create-the-transit-gateway-resources"></a>


| Task | 说明 | 所需技能 | 
| --- | --- | --- | 
| 创建中转网关。 | [See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_cn/prescriptive-guidance/latest/patterns/extend-vrfs-to-aws-by-using-aws-transit-gateway-connect.html) | 网络管理员、云架构师 | 
| 创建中转网关路由表。 | 按照[创建中转网关路由表](https://docs.aws.amazon.com/vpc/latest/tgw/tgw-route-tables.html#create-tgw-route-table)中的说明进行操作。请注意此示例以下几点：[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_cn/prescriptive-guidance/latest/patterns/extend-vrfs-to-aws-by-using-aws-transit-gateway-connect.html) | 云架构师、网络管理员 | 

### 创建中转虚拟接口
<a name="create-the-transit-virtual-interfaces"></a>


| Task | 说明 | 所需技能 | 
| --- | --- | --- | 
| 创建中转虚拟接口。 | [See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_cn/prescriptive-guidance/latest/patterns/extend-vrfs-to-aws-by-using-aws-transit-gateway-connect.html) | 云架构师、网络管理员 | 

### 创建 Direct Connect 资源
<a name="create-the-direct-connect-resources"></a>


| Task | 说明 | 所需技能 | 
| --- | --- | --- | 
| 创建 Direct Connect 网关。 | [See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_cn/prescriptive-guidance/latest/patterns/extend-vrfs-to-aws-by-using-aws-transit-gateway-connect.html) | 云架构师、网络管理员 | 
| 将 Direct Connect 网关连接到公交 VIFs。 | [See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_cn/prescriptive-guidance/latest/patterns/extend-vrfs-to-aws-by-using-aws-transit-gateway-connect.html) | 云架构师、网络管理员 | 
| 使用允许的前缀创建 Direct Connect 网关关联。 | 在网络中心账户中，按照[关联中转网关](https://docs.aws.amazon.com/directconnect/latest/UserGuide/direct-connect-transit-gateways.html#associate-tgw-with-direct-connect-gateway)中的说明进行操作。请注意此示例以下几点：[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_cn/prescriptive-guidance/latest/patterns/extend-vrfs-to-aws-by-using-aws-transit-gateway-connect.html)<br />创建此关联会自动创建具有 Direct Connect 网关资源类型的中转网关连接。此连接不需要与中转网关路由表关联。 | 云架构师、网络管理员 | 
| 创建中转网关 Connect 连接。 | [See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_cn/prescriptive-guidance/latest/patterns/extend-vrfs-to-aws-by-using-aws-transit-gateway-connect.html) | 云架构师、网络管理员 | 
| 创建中转网关 Connect 对等节点。 | [See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_cn/prescriptive-guidance/latest/patterns/extend-vrfs-to-aws-by-using-aws-transit-gateway-connect.html) |  | 

### 将路由传播到路由器
<a name="advertise-routes-to-the-routers"></a>


| Task | 说明 | 所需技能 | 
| --- | --- | --- | 
| 传播路由。 | 将新的中转网关 Connect 连接与您之前为此 VRF 创建的路由表相关联。例如，将生产中转网关 Connect 连接与 `Production-VRF`路由表关联。<br />为通告到路由器的前缀创建静态路由。[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_cn/prescriptive-guidance/latest/patterns/extend-vrfs-to-aws-by-using-aws-transit-gateway-connect.html) | 网络管理员、云架构师 | 

## 相关资源
<a name="extend-vrfs-to-aws-by-using-aws-transit-gateway-connect-resources"></a>

**AWS 文档**
+ Direct Connect 文档
  + [使用 Direct Connect 网关](https://docs.aws.amazon.com/directconnect/latest/UserGuide/direct-connect-gateways.html)
  + [中转网关关联](https://docs.aws.amazon.com/directconnect/latest/UserGuide/direct-connect-transit-gateways.html)
  + [AWS Direct Connect 虚拟接口](https://docs.aws.amazon.com/directconnect/latest/UserGuide/WorkingWithVirtualInterfaces.html)
+ Transit Gateway 文档
  + [使用中转网关](https://docs.aws.amazon.com/vpc/latest/tgw/working-with-transit-gateways.html)
  + [将中转网关连接到 Direct Connect 网关](https://docs.aws.amazon.com/vpc/latest/tgw/tgw-dcg-attachments.html)
  + [中转网关 Connect 连接和中转网关 Connect 对等节点](https://docs.aws.amazon.com/vpc/latest/tgw/tgw-connect.html)
  + [创建中转网关 Connect 连接](https://docs.aws.amazon.com/vpc/latest/tgw/tgw-connect.html#create-tgw-connect-attachment)

**AWS Blog 文章**
+ [使用 AWS Transit Gateway 连接对混合网络执行分段](https://aws.amazon.com/blogs/networking-and-content-delivery/segmenting-hybrid-networks-with-aws-transit-gateway-connect/)
+ [使用 AWS Transit Gateway 连接来扩展 VRFs 和增加 IP 前缀广告](https://aws.amazon.com/blogs/networking-and-content-delivery/using-aws-transit-gateway-connect-to-extend-vrfs-and-increase-ip-prefix-advertisement/)

## 附件
<a name="attachments-db17e177-6c94-4d81-ab39-0923ecab2f1b"></a>

要访问与此文档相关联的其他内容，请解压以下文件：[attachment.zip](samples/p-attach/db17e177-6c94-4d81-ab39-0923ecab2f1b/attachments/attachment.zip)