Updated on 2024-01-16 GMT+08:00

Replacement Steps

Step 1: Create Cloud Resources

Table 4 lists all required cloud resources in this example.

  1. Create a subnet in each VPC.

    The subnets are used to verify communications between the VPCs and enterprise router during the replacement. In this example, three verification subnets are required. For more resource details, see Table 5.

    For details, see Creating a VPC.

  2. Create an ECS in each verification subnet.

    In this example, three verification ECSs are required. For more resource details, see Table 7.

    For details, see Methods of Purchasing ECSs.

  3. Create an enterprise router.

    In this example, the CIDR blocks of VPCs connected by VPC peering connections do not overlap. Therefore, enable both Default Route Table Association and Default Route Table Propagation when creating the enterprise router. For more resource details, see Table 3.

    If the CIDR blocks of VPCs connected by a VPC peering connection overlap, do not enable Default Route Table Propagation for the enterprise router. This function adds routes with entire VPC CIDR blocks as destinations. If VPC CIDR blocks overlap, there will be route conflicts. In this case, you need to manually add routes with next hop set to VPC attachment to the route table of the enterprise router.

    For details, see Creating an Enterprise Router.

    Figure 1 Enterprise router details

Step 2: Create VPC Attachments and Add Routes

  1. Create three VPC attachments to attach the VPCs to the enterprise router.

    Do not enable Auto Add Routes when creating the attachments. For more resource details, see Table 3.

    If this option is enabled, Enterprise Router automatically adds routes (with this enterprise router as the next hop and 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16 as the destinations) to all route tables of the VPC. During the replacement, manually add routes with destinations set to the large CIDR block to the VPC route tables.

    For details, see Creating VPC Attachments to the Enterprise Router.

  2. Check the routes with destinations set to the VPC CIDR blocks in the enterprise router route table.

    In this example, Default Route Table Association and Default Route Table Propagation are enabled for the enterprise router, and routes with destinations set to VPC CIDR blocks are automatically added when you attach the VPCs to the enterprise router.

    If Default Route Table Propagation is not enabled when creating the enterprise router, you need to manually add routes with destinations set to the VPC CIDR blocks to the enterprise router route table. For details, see Creating a Static Route.

    Table 1 and Table 3 lists the routes required.

    To view enterprise routes, see Viewing Routes.

Step 3: Verify communications Between the VPCs and Enterprise Router

  1. Add routes with the next hop set to the enterprise router in the VPC route tables.

    For VPC route details, see Table 1.

    For details, see Adding Routes to VPC Route Tables.

    In this example, the routes to be added are required during the replacement in Table 2 and have next hop set to the enterprise router.

    • Add routes with destinations set to 172.17.253.0/29 and 172.18.253.0/29 to the route table of VPC-A.
    • Add routes with destinations set to 172.16.253.0/29 and 172.18.253.0/29 to the route table of VPC-B.
    • Add routes with destinations set to 172.16.253.0/29 and 172.17.253.0/29 to the route table of VPC-C.

  2. Verify communications between the VPCs and enterprise router.

    Multiple methods are available for logging in to an ECS. For details, see Logging In to an ECS.

    In this example, use VNC provided on the management console to log in to the ECSs.
    1. Log in to ecs-A02 to check whether VPC-A can communicate with VPC-B through the enterprise router.

      ping Private IP address of ecs-B02

      Example command:

      ping 172.17.253.4

      If information similar to the following is displayed, VPC-A can communicate with VPC-B through the enterprise router.
      [root@ecs-A02 ~]# ping 172.17.253.4
      PING 172.17.253.4 (172.17.253.4) 56(84) bytes of data.
      64 bytes from 172.17.253.4: icmp_seq=1 ttl=64 time=0.849 ms
      64 bytes from 172.17.253.4: icmp_seq=2 ttl=64 time=0.455 ms
      64 bytes from 172.17.253.4: icmp_seq=3 ttl=64 time=0.385 ms
      64 bytes from 172.17.253.4: icmp_seq=4 ttl=64 time=0.372 ms
      ...
      --- 172.17.253.4 ping statistics ---
    2. Log in to ecs-A02 to check whether VPC-A can communicate with VPC-C through the enterprise router.

      ping Private IP address of ecs-C02

      Example command:

      ping 172.18.253.5

      If information similar to the following is displayed, VPC-A can communicate with VPC-C through the enterprise router.
      [root@ecs-A02 ~]# ping 172.18.253.5
      PING 172.18.253.5 (172.18.253.5) 56(84) bytes of data.
      64 bytes from 172.18.253.5: icmp_seq=1 ttl=64 time=0.849 ms
      64 bytes from 172.18.253.5: icmp_seq=2 ttl=64 time=0.455 ms
      64 bytes from 172.18.253.5: icmp_seq=3 ttl=64 time=0.385 ms
      64 bytes from 172.18.253.5: icmp_seq=4 ttl=64 time=0.372 ms
      ...
      --- 172.18.253.5 ping statistics ---
    3. Log in to ecs-B02 to check whether VPC-B can communicate with VPC-C through the enterprise router.

      ping Private IP address of ecs-C02

      Example command:

      ping 172.18.253.5

      If information similar to the following is displayed, VPC-B can communicate with VPC-C through the enterprise router.
      [root@ecs-B02 ~]# ping 172.18.253.5
      PING 172.18.253.5 (172.18.253.5) 56(84) bytes of data.
      64 bytes from 172.18.253.5: icmp_seq=1 ttl=64 time=0.849 ms
      64 bytes from 172.18.253.5: icmp_seq=2 ttl=64 time=0.455 ms
      64 bytes from 172.18.253.5: icmp_seq=3 ttl=64 time=0.385 ms
      64 bytes from 172.18.253.5: icmp_seq=4 ttl=64 time=0.372 ms
      ...
      --- 172.18.253.5 ping statistics ---

  3. After the verification, delete the routes, ECSs, and subnets that are used for verifying communications.

    1. Delete the routes that are used for verifying communications from the three VPC route tables.

      In this example, the routes to be deleted are the ones required during the replacement in Table 2 and have next hop set to the enterprise router.

      • Delete routes with destinations set to 172.17.253.0/29 and 172.18.253.0/29 from the route table of VPC-A.
      • Delete routes with destinations set to 172.16.253.0/29 and 172.18.253.0/29 from the route table of VPC-B.
      • Delete routes with destinations set to 172.16.253.0/29 and 172.17.253.0/29 from the route table of VPC-C.

      To delete a route, refer to Deleting a Route.

    2. Delete the ECSs deployed in the three verification subnets.

      In this example, delete ecs-A02, ecs-B02, and ecs-C02 that are listed in Table 7.

      To delete an ECS, refer to How Can I Delete or Restart an ECS?

    3. Delete the three verification subnets.

      In this example, delete subnet-A02, subnet-B02, and subnet-C02 that are listed in Table 5.

      To delete a subnet, see Deleting a Subnet.

      Before deleting a subnet, delete the ECSs in the subnet. Otherwise, the subnet cannot be deleted.

Step 4: Add Routes to VPC Route Tables

For VPC route details, see Table 1.

  1. Add routes to the route tables of VPC-A, VPC-B, and VPC-C.

    For details, see Adding Routes to VPC Route Tables.

    1. Add routes that are used for temporary communications and have next hop set to VPC peering connection.

      These routes ensure that traffic is not interrupted when original routes added for VPC peering connections are deleted.

      In this example, the routes to be added are required during the replacement in Table 2 and have next hop set to VPC peering connection.

      • Add a route with destination set to 1.1.1.1/32 to the route table of VPC-A.
      • Add a route with destination set to 1.1.1.2/32 to the route table of VPC-B.
      • Add a route with destination set to 1.1.1.3/32 to the route table of VPC-C.
    2. Add routes with destinations set to a large CIDR block and next hop set to enterprise router.

      The route destinations must contain CIDR blocks of all VPCs that need to communicate with each other and cannot be used by any other services.

      In this example, the routes to be added are required during and after the replacement in Table 2 and have next hop set to the enterprise router.

      • Add a route with destination set to 172.16.0.0/14 to the route table of VPC-A.
      • Add a route with destination set to 172.16.0.0/14 to the route table of VPC-B.
      • Add a route with destination set to 172.16.0.0/14 to the route table of VPC-C.

Step 5: Perform the Replacement

  1. Delete the original routes with the next hop set to the VPC peering connection from the three VPC route tables.

    In this example, the routes to be deleted are required before and during the replacement in Table 2.

    • Delete routes with destinations set to 172.17.0.0/24 and 172.18.0.0/24 from the route table of VPC-A.
    • Delete routes with destinations set to 172.16.0.0/24 and 172.18.0.0/24 from the route table of VPC-B.
    • Delete routes with destinations set to 172.16.0.0/24 and 172.17.0.0/24 from the route table of VPC-C.

    To delete a route, refer to Deleting a Route.

    Log in to the ECSs where services are running and use ping to check whether the traffic is interrupted. If traffic is interrupted, add the deleted routes immediately.

Step 6: Delete the Original VPC Peering Connections

After the replacement is complete and you have verified that services are running properly, delete the VPC peering connections.

  1. Delete the three VPC peering connections.

    Deleting the VPC peering connections will also delete the routes for temporary communications in the VPC route tables.
    • Table 6 lists the details about the VPC peering connections to be deleted.
    • Deleting the VPC peering connections will also delete the routes whose next hop is VPC peering connection and that are required during the replacement in Table 2.
      • Delete the route with destination set to 1.1.1.1/32 from the route table of VPC-A.
      • Delete the route with destination set to 1.1.1.2/32 from the route table of VPC-B.
      • Delete the route with destination set to 1.1.1.3/32 from the route table of VPC-C.

    To delete a VPC peering connection, see Deleting a VPC Peering Connection.