This section describes how to use Transit Routers (TRs) to implement interconnectivity between two VPCs (vpc01 and vpc02) and another VPC (vpc03) in different accounts and regions. After connecting, both vpc01 and vpc02 can communicate with vpc03 via the TR, but vpc01 and vpc02 cannot mutually communicate, as shown below.
Prerequisites
- You have created three Virtual Private Clouds (VPCs) and their subnets. For procedure, see Building an IPv4 VPC.
tip
Ensure that neither VPC contains conflicting subnets. That is, no duplicate or overlapping CIDR blocks exist.
- You have created Elastic Compute Service (ECS) instances in the three VPCs. For procedure, see Buying ECS instances.
Routing planning
In a single TR instance, multiple network instances with the identical access destination can use the same TR route table to forward traffic.
- Within China (Guangzhou): Since both vpc01 and vpc02 only need to access vpc03, their traffic can share a single TR route table. However, the inter-region attachment requires access to distinct destinations (both vpc01 and vpc02). Therefore, a separate TR route table is required to handle this traffic.
- Within China (Beijing): vpc03 and the inter-region attachment require access to the same destinations (both vpc01 and vpc02). So only one TR route table is required.
In summary, at least three TR route tables are required to enable connectivity and isolation between different VPCs. The following figure illustrates the specific route planning.
Configuration procedures
- Create a TR instance: Create a TR instance in China (Guangzhou).
- Create a TR custom route table: Create a custom route table for the TR instance to receive and forward network traffic along with the TR system route table.
- Create a network instance attachment and configure routing: Create two network instance attachments on the TR instance to connect the two VPCs in this region. On the TR side, configure association forwarding and route learning to control the traffic flow to and from these VPCs. On the VPC side, configure auto publishing to control flow direction.
- View TR and VPC routes: Check that the routes of the TR instance and two VPCs in the same region meet expectations.
- Create a TR instance: Create a TR instance in China (Beijing).
- Create instance sharing: Create a sharing unit for the TR instance in China (Beijing) and share it with Account B.
- Create a network instance attachment and configuring routing (Account B): Use Account B to create a network instance attachment on the shared TR instance, connecting the shared TR instance to vpc03 under my account. On the TR side, configure association forwarding and route learning to control the traffic flow to and from these VPCs. On the VPC side, configure auto publishing to control flow direction.
- Create a bandwidth package: Create a bandwidth package to provide bandwidth resources for the inter-region attachment.
- Create an inter-region attachment and configure routing: Create an inter-region attachment to connect the TR instances in the two regions above. Allocate bandwidth for the attachment. Configure association forwarding and route learning to implement route propagation between the two TR instances.
- View TR and VPC routes: Check that the routes of two TR instances in different regions and two VPCs under Account A meet expectations.
- Verification: Run ping to verify the connectivity between ECS instances in different VPCs to ensure that the VPCs are connected and isolated as expected.
Configuration procedures
Step 1: Configure a TR instance in China (Guangzhou) (Account A)
I. Create a TR instance
- In the top menu bar, select the target project and region.
- Click Create TR and configure related parameters based on the table below.
- Click Create to complete the creation of the TR instance.
tip
When you create a TR instance, the system automatically creates a system route table for it. Record the name of this system route table: tr01-rtb-sys. The following uses tr01-rtb-sys as an example.
Ⅱ. Create a TR custom route table
- Click the name of the created TR instance.
- In the zone below Basic information, select the Route Table tab.
- Click Create Route Table to the right of the Route Table List, and type in tr01-rtb-set as the route table's name.
- Click Create to complete the creation of the TR route table.
Ⅲ. Create a network instance attachment and configure routing
Create two network instance attachments to connect to vpc01 and vpc02 separately by the following steps.
- In the section below Basic information, select the Intra-region attachments tab.
- Click Create attachment, and complete the basic configuration for the network instance attachment based on the table below.
- Complete the route configuration for the network instance attachment based on the table below.
- Click Buy now to complete the action.
IV. View TR and VPC routes
- View routes of TR route tables (tr01-rtb-sys and tr01-rtb-set) in sequence.
- Currently, no routes exist in tr01-rtb-sys.
- The routes in tr01-rtb-set are listed in the following table.
- View routes of the vpc01 and vpc02 route tables in sequence to confirm no changes.
- Since the routes in tr01-rtb-sys are automatically published to the vpc01 and vpc02 route tables, routes in the vpc01 and vpc02 route tables are unchanged.
Step 2: Configure a TR instance in China (Beijing) (Account A)
I. Create a TR instance
- Back to the TR Instances page, and select the target project and region in the top menu bar.
- Click Create TR and configure related parameters based on the table below.
- Click Create to complete the creation of the TR instance.
tip
When you create a TR instance, the system automatically creates a system route table for it. Record the name of this system route table: tr02-rtb-sys. The following uses tr02-rtb-sys as an example.
II. Create instance sharing
- Click the account avatar in the upper right corner.
- Select Tools > Resource.
- In the left-side navigation pane, select Resource sharing > Shared by me.
- In the top menu bar, select your target region.
- On the Shared unit tab, click Create shared unit and configure the parameters based on the table below.
- Click Next to associate sharing permissions.
- TR sharing permissions are system-defined and cannot be modified. For default supported actions, see Instructions.
- Click Next to associate shared users.
- Click Next to confirm that the resources, associated permissions, and shared users are correct.
- Click Confirm to complete the action.
Step 3: Accept sharing invitation (Account B)
- In the top menu bar, select the region to which the shared TR belongs.
- Click Accept to the right of the shared unit to complete the action.
- Click Accept to the right of the shared TR instance to confirm the sharing information.
- Click Accept to complete the action.
- Upon acceptance, the status of this shared TR instance updates from Pending acceptance to Accepted.
Step 4: Create a network instance attachment and configure routing (Account B)
- On the TR instance list page, click the name of the created TR instance.
- In the section below Basic information, select the Intra-region attachment tab.
- Click Create attachment, and complete the basic configuration for the network instance attachment based on the table below.
- Complete the route configuration for the network instance attachment based on the table below.
- Click Buy now to complete the action.
- View the routes in tr02-rtb-sys, as shown in the table below.
- View routes in the vpc03 route table to confirm no changes.
- Since the routes in tr02-rtb-sys are automatically published to the vpc03 route table. This TR route table contains no routes whose Next Hop is not vpc03, so routes in the vpc03 route table are unchanged.
Step 5: Configure inter-region bandwidth (Account A)
I. Create a bandwidth package
- In the left-side navigation pane, select Bandwidth Package.
- Click Create bandwidth package, and configure the bandwidth package based on the table below.
- In the right-side Configuration details box, follow the console guidance to review and accept the legal terms.
- Click Submit order to complete the action.
Ⅱ. Create an inter-region attachment and configure routing
- In the top menu bar, select the target project and region. The following example is a default project in China (Guangzhou).
- In the left-side navigation pane, select Transit Router and click the name of the target TR instance.
- In the section below Basic information, select the Inter-region attachment tab.
- Click Create inter-region attachment and configure basic information based on the table below.
- Configure route information for the inter-region attachment based on the table below.
- Click Create to complete the action.
Ⅲ. View TR and VPC routes
- View routes in TR route tables (tr01-rtb-sys and tr02-rtb-sys) in sequence, as shown in the table below.
- View the routes in the vpc01 and vpc02 route tables in sequence, as shown in the table below.
Step 6: View VPC routes (Account B)
View the routes in the vpc03 route table, as shown in the table below.
Verification
The following verification steps take a Linux-based ECS as an example:
- Execute the ping command to connect the private IP addresses of respective ECS instances in vpc02 and vpc03, verifying network connectivity.
- The ECS instances in vpc01 and vpc02 are mutually isolated and cannot ping each other.
- The ECS instances in vpc01 and vpc03 can mutually communicate and ping successfully.
- Similarly, remotely log in to the ECS instances in vpc02 and vpc03 to verify connectivity between vpc02, vpc03, and another VPC.