Help Center/ Cloud Connect/ Best Practices/ Enabling the Internet to Access Private Networks by Using Cloud Connect and DNAT
Updated on 2022-06-29 GMT+08:00

Enabling the Internet to Access Private Networks by Using Cloud Connect and DNAT

Scenarios

  • This practice provides detailed operations for the Internet outside the Chinese mainland to access private networks.
  • DNAT rules are required so that ECSs in the VPCs in the Chinese mainland can provide services accessible from the Internet.

Figure 1 shows the networking topology.

Figure 1 Networking

In this practice, we suppose that the VPC in CN East-Shanghai1 is the on-premises network.

The CIDR block of the Internet outside the Chinese mainland is 0.0.0.0/0.

Your account must have the permission for cross-border network communication. If your account does not have the permission, you can ask the other user with the required permission to load the VPCs.

Procedure

  1. Create the following VPCs and ensure that the VPC CIDR blocks do not conflict with each other:

    • VPC in CN East-Shanghai1: 172.16.36.0/24
    • VPC in CN-Hong Kong: 192.168.120.0/24

    For details, see Creating a VPC.

  1. Configure Cloud Connect.

    1. Create a cloud connection.

      For details, see Creating a Cloud Connection.

    2. Load the VPCs.

      For details, see Loading a Network Instance.

    3. Add a custom CIDR block.

      For details, see Adding a Custom CIDR block.

      When you load the VPC in CN-Hong Kong, you need to add the custom CIDR block 0.0.0.0/0.

      You need to add the default route 0.0.0.0/0 to allow access from the NAT gateway.

    4. Buy a bandwidth package.

      By default, the system allocates 10 kbit/s of bandwidth for testing network connectivity across regions. You need to buy a bandwidth package to ensure normal network communications across regions.

      For details, see Buying a Bandwidth Package.

    5. Assign an inter-region bandwidth.

      For details, see Assigning Inter-Region Bandwidth.

  1. Buy an ECS in CN East-Shanghai1.

    For details, see Purchasing an ECS.

    Private IP address of the ECS in CN East-Shanghai1: 172.16.36.220

  2. Buy an EIP and configure a NAT gateway.

    Purchase an EIP in CN-Hong Kong, purchase a public NAT gateway, and add a DNAT rule. (Select Direct Connect/Cloud Connect when you add the DNAT rule.)

    For details, see Assigning an EIP and Binding It to an ECS and Adding a DNAT Rule.

    Set the private IP address to 172.16.36.220 when you add the DNAT rule.

    The DNAT rule enables the ECS to provide services accessible from the Internet.

Verification

Test network connectivity.

Ping the EIP bound to the DNAT rule and the port used by the EIP from any client on the Internet.