3 min read

[LAB] Create VPC peering and routing table

[LAB] Create VPC peering and routing table

Introduction:
In this step-by-step lab guide, we will walk you through the process of setting up VPC peering in Alibaba Cloud. By following this example-based tutorial, you will gain hands-on experience in creating VPCs, establishing peering connections, and configuring routing tables. Let's dive in and explore the power of VPC peering in Alibaba Cloud.

Lab Requirements:
To complete this lab, you will need:

  1. An Alibaba Cloud account.
  2. Access to the Alibaba Cloud console.
  3. Basic knowledge of networking concepts.

Lab Scenario:
In this lab, we will create two VPCs, VPC A and VPC B, in the same region (Region A). We will establish a peering connection between these VPCs, allowing private network communication. Let's proceed with the step-by-step instructions.

Step 1: Create VPCs:

Log in to the Alibaba Cloud console.

Navigate to the Virtual Private Cloud (VPC) service.

Click on "Create VPC" and provide the following details for VPC A:

  • VPC Name: LabVPC-A
  • IPv4 CIDR Block: 192.168.0.0/16 (or choose a CIDR block of your preference)
  • VSwitch: Create a VSwitch within VPC A with a CIDR block (e.g., 192.168.1.0/24)
Create VPC Console

Repeat the process to create VPC B with the following details:

  • VPC Name: LabVPC-B
  • IPv4 CIDR Block: 10.0.0.0/16 (or choose a CIDR block of your preference)
  • VSwitch: Create a VSwitch within VPC B with a CIDR block (e.g., 10.0.1.0/24)
Create VPC Console

Step 2: Establish VPC Peering Connection:

  1. Go to the VPC service and select "VPC Peering Connections."
Create VPC peering connection

Click on "Create Peering Connection" and provide the following details:

Creating new Peering connection
  • Peering Connection Name: LabPeering
  • Local Region: Select Region A
  • Local VPC: Select LabVPC-A
  • Peer Region: Select Region A
  • Peer VPC: Select LabVPC-B
Option to create a Peering connection

Step 3: Configure Routing Tables:

Navigate to the VPC service and select "Routing Tables."

Create a new routing table for LabVPC-A.

Edit Route table to update/Add Route to peered VPC

Edit the routing table and add a route entry:

Edit Route table to update/Add Route to peered VPC
  • Destination CIDR Block: CIDR block of LabVPC-B (e.g., 10.0.0.0/16)
  • Next Hop Type: VPC Peering Connection
  • Next Hop: Select the LabPeering connection
Option for adding route table

Repeat the process to create a routing table for LabVPC-B, adding a route entry for LabVPC-A's CIDR block (e.g., 192.168.0.0/16) with the LabPeering connection as the next hop.

Option for adding route table

Step 4: Test Connectivity:

  1. Launch an ECS instance in LabVPC-A's VSwitch.
  2. Launch another ECS instance in LabVPC-B's VSwitch.
  3. Assign public IP addresses to both instances.
  4. Connect to each instance via SSH/RDP using the public IP addresses.
  5. Ping the private IP address of the instance in the other VPC.
  6. Verify that the instances can communicate successfully.

Conclusion:
In this lab, we explored the process of setting up VPC peering in Alibaba Cloud. We created two VPCs, established a peering connection between them, and configured the necessary routing tables. By completing this lab, you gained practical experience in leveraging VPC peering to enhance network connectivity and enable secure communication between VPCs.

VPC peering is a powerful feature that can significantly enhance your cloud infrastructure's flexibility and scalability. Remember to tear down the resources created in this lab to avoid unnecessary costs. We encourage you to further explore Alibaba Cloud's VPC peering capabilities and experiment with different scenarios to deepen your understanding.