Help Center> Enterprise Router> Best Practices> Enabling an On-Premises Data Center to Access Service VPCs Using an Enterprise Router and Transit VPC> Procedure for Enabling an On-Premises Data Center to Access Service VPCs Using Enterprise Router and Transit VPC
Updated on 2024-06-27 GMT+08:00

Procedure for Enabling an On-Premises Data Center to Access Service VPCs Using Enterprise Router and Transit VPC

Step 1: Create Cloud Resources

Create an enterprise router, two service VPCs, a transit VPC, and two ECSs. For details about these resources, see Table 5.

  1. Create an enterprise router.

    Disable Default Route Table Propagation when you create the enterprise router. For details, see Table 9.

    For details, see Creating an Enterprise Router.

  2. Create two service VPCs and a transit VPC.

    For details, see Creating a VPC.

  3. Create two ECSs.

    In this example, the ECSs are used to verify network communications. The quantity and configuration are for reference only.

    For details, see Overview.

Step 2: Create VPC Peering Connections and Configure Routes

  1. Create a VPC peering connection between each service VPC and the transit VPC.

    1. Create VPC peering connection Peer-A-T to connect VPC-A and VPC-Transit.
    2. Create VPC peering connection Peer-B-T to connect VPC-B and VPC-Transit.

    For details about the VPC peering connections, see Table 7.

  2. In the route tables of VPC-A, VPC-B, and VPC-Transit, add routes with the next hop being the corresponding VPC peering connection.

    For details, see Adding Routes to VPC Route Tables.

    In this example, add the routes in Table 3, and the next hop is the corresponding VPC peering connection.

    • Add two routes in the route table of VPC-A with destination set to 172.17.0.0/16 and 10.10.0.0/16.
    • Add two routes in the route table of VPC-B with destination set to 172.16.0.0/16 and 10.10.0.0/16.
    • Add two routes to the route table of VPC-Transit with destination set to 172.17.0.0/16 and 172.16.0.0/16.

  3. Verify network connectivity between VPC-A and VPC-B.

    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-A and verify that VPC-A and VPC-B can communicate with each other over the VPC peering connections.

      ping Private IP address of ECS-B

      Example command:

      ping 172.17.1.113

      If information similar to the following is displayed, the communications between VPC-A and VPC-B are normal:
      [root@ECS-A ~]# ping 172.17.1.113
      PING 172.17.1.113 (172.17.1.113) 56(84) bytes of data.
      64 bytes from 172.17.1.113: icmp_seq=1 ttl=64 time=0.849 ms
      64 bytes from 172.17.1.113: icmp_seq=2 ttl=64 time=0.455 ms
      64 bytes from 172.17.1.113: icmp_seq=3 ttl=64 time=0.385 ms
      64 bytes from 172.17.1.113: icmp_seq=4 ttl=64 time=0.372 ms
      ...
      --- 172.17.1.113 ping statistics ---
    2. Log in to ECS-B and verify that VPC-B can communicate with VPC-A over the VPC peering connections.

      ping Private IP address of ECS-A

      Example command:

      ping 172.16.1.25

      If information similar to the following is displayed, the communications between VPC-B and VPC-A are normal:
      [root@ECS-B ~]# ping 172.16.1.25
      PING 172.16.1.25 (172.16.1.25) 56(84) bytes of data.
      64 bytes from 172.16.1.25: icmp_seq=1 ttl=64 time=0.849 ms
      64 bytes from 172.16.1.25: icmp_seq=2 ttl=64 time=0.455 ms
      64 bytes from 172.16.1.25: icmp_seq=3 ttl=64 time=0.385 ms
      64 bytes from 172.16.1.25: icmp_seq=4 ttl=64 time=0.372 ms
      ...
      --- 172.16.1.25 ping statistics ---

Step 3: Create a VPC Attachment to the Enterprise Router

  1. Attach the transit VPC to the enterprise router.

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

    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. In this example, the CIDR block of each service VPC needs to be added as the route destination.

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

  2. In the route table of the transit VPC, add a route with the next hop as the enterprise router.

    For details, see Adding Routes to VPC Route Tables.

    In this example, add a route in the route table of VPC-Transit, with the next hop as the enterprise router and destination as 10.10.0.0/16.

  3. In the route table of the enterprise router, add static routes with the next hop as the VPC attachment.

    For details, see Creating a Static Route.

    In this example, add routes in the route table of the enterprise router, with the next hop as the VPC-Transit attachment. The destination of one route is 172.16.0.0/16, and that of the other is 172.17.0.0/16. For details, see Table 4.

Step 4: Create a Virtual Gateway Attachment to the Enterprise Router

For details about Direct Connect resources, see Table 8.

  1. Create a connection.

    For details, see Creating a Connection.

  2. Create a virtual gateway and attach it to the enterprise router.

    1. On the Direct Connect console, create a virtual gateway.

      For details, see Step 2: Create a Virtual Gateway.

    2. On the Enterprise Router console, check whether the virtual gateway attachment has been added to the enterprise router.

      For details, see Viewing Details About an Attachment.

      If the status of the virtual gateway attachment is Normal, the attachment has been added.

      In this example, Default Route Table Association was enabled but Default Route Table Propagation was disabled during the creation of the enterprise router. After the virtual gateway attachment is added:
      • An association is automatically created in the default route table of the enterprise router.
      • You need to manually create a propagation to proceed to 3.

  3. In the route table of the enterprise router, create a propagation for the virtual gateway attachment to automatically learn the routes of the on-premises data center.

    For details about creating a propagation, see Creating a Propagation.

    You can view routes to the on-premises data center in the route table of the enterprise router only after taking the following steps.

  4. Create a virtual interface.

    Create a virtual interface to connect the virtual gateway with the on-premises data center. For details, see Step 3: Create a Virtual Interface.

  5. Configure routes on the network device in the on-premises data center.

    The following uses a Huawei network device as an example to describe how to configure a BGP route.

    bgp 65525

    peer 10.0.0.1 as-number 64512

    peer 10.0.0.1 password simple 12345678

    network 10.10.0.0 255.255.0.0

    Table 1 BGP route

    Command

    Description

    bgp 65525

    Enables BGP.

    65525 is the ASN used by the on-premises data center.

    peer 10.0.0.1 as-number 64512

    Creates a BGP peer.
    • 10.0.0.1 is the gateway on Huawei Cloud.
    • 64512 is the ASN used by Huawei Cloud. The value must be 64512.

    peer 10.0.0.1 password simple 12345678

    Performs MD5 authentication on BGP messages when a TCP connection is established between BGP peers.

    12345678 is the BGP MD5 authentication password.

    network 10.10.0.0 255.255.0.0

    Adds routes in the IP route table to the BGP route table.

    • 10.10.0.0 is the network used by the on-premises data center.
    • 255.255.0.0 is the subnet mask of the on-premises network.

Step 5: Verify Network Connectivity Between the Service VPCs and On-Premises Data Center

  1. Log in to the ECSs and verify the communications between each service VPC and the on-premises data center.

    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-A and run the following command to check whether VPC-A can communicate with the on-premises data center through the enterprise router:

      ping IP address used in the on-premises data center

      Example command:

      ping 10.10.0.27

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

      ping IP address used in the on-premises data center

      Example command:

      ping 10.10.0.30

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

  2. Log in to the ECSs and verify the communications between service VPCs.

    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-A and verify that VPC-A and VPC-B can communicate with each other over the VPC peering connections.

      ping Private IP address of ECS-B

      Example command:

      ping 172.17.1.113

      If information similar to the following is displayed, the communications between VPC-A and VPC-B are normal:
      [root@ECS-A ~]# ping 172.17.1.113
      PING 172.17.1.113 (172.17.1.113) 56(84) bytes of data.
      64 bytes from 172.17.1.113: icmp_seq=1 ttl=64 time=0.849 ms
      64 bytes from 172.17.1.113: icmp_seq=2 ttl=64 time=0.455 ms
      64 bytes from 172.17.1.113: icmp_seq=3 ttl=64 time=0.385 ms
      64 bytes from 172.17.1.113: icmp_seq=4 ttl=64 time=0.372 ms
      ...
      --- 172.17.1.113 ping statistics ---
    2. Log in to ECS-B and verify that VPC-B can communicate with VPC-A over the VPC peering connections.

      ping Private IP address of ECS-A

      Example command:

      ping 172.16.1.25

      If information similar to the following is displayed, the communications between VPC-B and VPC-A are normal:
      [root@ECS-B ~]# ping 172.16.1.25
      PING 172.16.1.25 (172.16.1.25) 56(84) bytes of data.
      64 bytes from 172.16.1.25: icmp_seq=1 ttl=64 time=0.849 ms
      64 bytes from 172.16.1.25: icmp_seq=2 ttl=64 time=0.455 ms
      64 bytes from 172.16.1.25: icmp_seq=3 ttl=64 time=0.385 ms
      64 bytes from 172.16.1.25: icmp_seq=4 ttl=64 time=0.372 ms
      ...
      --- 172.16.1.25 ping statistics ---