Help Center> Cloud Container Engine> Best Practices> Networking> Connecting Two VPCs Across Regions Through a VPN (VPC Router Networking)

Connecting Two VPCs Across Regions Through a VPN (VPC Router Networking)

Prerequisites

The cluster's network model is VPC router. The local and peer subnets cannot overlap. Local subnet CIDR blocks cannot overlap. The local and peer VPCs are in different regions. (VPCs in the same region can be connected through a VPC peering connection.)

Deployment Architecture

Table 1 Local VPC

VPN Gateway IP

Subnet CIDR Block

Container CIDR Block

124.70.127.235

192.168.10.0/24

172.16.0.0/16

Table 2 Peer VPC

VPN Gateway IP

Subnet CIDR Block

119.3.121.239

192.168.20.0/24

Procedure

  1. Create VPN gateways and VPN connections on the local and peer VPCs.

    1. Log in to the management console.
    2. Click Service List. Under Network, click Virtual Private Network.
    3. On the displayed page, click Create VPN Gateway.
    4. On the page displayed, set Billing Mode to Pay-per-use and retain the default values for other parameters.
    5. In the VPN Connection area, set the local VPN by referring to Figure 1.
      Figure 1 Local VPN
    6. Repeat the preceding operations to create a peer VPN.
      Figure 2 Peer VPN

      After a VPN is created, its status only changes to Normal if the servers on both ends of the VPN can communicate with each other. For details, see Connecting to a VPC Through a VPN.

  2. Choose Service List > Computing > Elastic Cloud Server and access the details page of the container node. On the NICs tab page, disable Source/Destination Check for the local and peer ECSs. After Source/Destination Check is enabled, the source IP address in a packet is checked. If the source IP address is incorrect or changed, the packet cannot be sent. Therefore, the source/destination check function must be disabled.

    Figure 3 Disabling source/destination check

  3. Enable the ICMP protocol on the local and peer ECSs.

    1. On the details page of the container node, click the Security Groups tab and click the security group name to expand the security group rules.
    2. Click Modify Security Group Rule on the right. On the displayed page, click the Inbound Rules tab and click Fast-Add Rule.
      Figure 4 Adding a rule
    3. Set Protocol Port to ICMP and click OK.
      Figure 5 Enabling ICMP

  4. Check whether the route table configuration is automatically delivered.

    1. Choose Service List > Network > Virtual Private Cloud.
    2. Click the VPC name. On the VPC details page, click Route Tables on the right.
    3. Click the name of the target route table. On the page displayed, view the VPN route information

  5. Return to the CCE console and view the pod IP address on the Pods tab page on the local workload details page.
  6. Log in to the remote ECS and access the container IP address in the local cluster.