Scenario
A user has two virtual private clouds (VPCs) in the China (Shanghai) region: vpc1, which is bound to an OpenSearch instance in the China (Shanghai) region, and vpc2. The user also has one VPC in the China (Qingdao) region. The CIDR blocks of these three VPCs do not overlap.
As the business grows, the user needs to access the private domain name of the OpenSearch instance from vpc2 in the China (Shanghai) region (same region) and from vpc3 in the China (Qingdao) region (cross-region). You can meet this requirement by configuring transit routers in a Cloud Enterprise Network (CEN) instance as described in this topic.
|
Region |
VPC |
CIDR block |
|
China (Shanghai) |
vpc1 |
10.0.0.0/10
|
|
vpc2 |
10.0.0.0/8
|
|
|
China (Qingdao) |
vpc3 |
172.16.0.0/12
|
Obtain the IP address of the OpenSearch instance domain name
On the details page of the OpenSearch instance, copy the Endpoint, and then ping the Endpoint of the OpenSearch instance to obtain its IP address. For example, the obtained IP address is 100.103.8.57.
Create a CEN instance and connect multiple VPCs
Access from multiple VPCs in the same region
Use CEN to connect the two VPCs to the transit router in the China (Shanghai) region so that resources in VPCs in the same region can quickly access each other.
-
Log on to the CEN console and create a CEN instance.
-
Create a transit router in the corresponding region. In this topic, the China (Shanghai) region is used.
-
On the transit router, create network instance connections for VPC1 and VPC2.
On the network instance connection page, configure the parameters described in the following table, and then click OK.
Configuration item
Description
VPC1
VPC2
Instance Type
Select the type of the network instance that you want to connect.
VPC
VPC
Region
Select the region where the network instance that you want to connect resides.
China (Shanghai)
China (Shanghai)
Transit Router
The system automatically displays the ID of the transit router instance that has been created in the region.
Account
Select the type of the account to which the network instance that you want to connect belongs.
Your Account
Your Account
Billing Method
Default valuePay-as-you-go.
Connection Name
Enter a name for the network instance connection.
VPC1 connection
VPC2 connection
Networks
Select the network instance that you want to connect.
Select VPC1
Select VPC2
vSwitch
Select a vSwitch instance in a zone supported by the transit router.
If you have vSwitch instances in multiple zones supported by the transit router, you can select multiple zones and select one vSwitch instance in each zone to implement zone-level disaster recovery.
-
Shanghai Zone F: Select vSwitch 1
-
Shanghai Zone G: Select vSwitch 2
-
Shanghai Zone F: Select vSwitch 1
-
Shanghai Zone G: Select vSwitch 2
Advanced Configuration
Keep the default settings for both VPC1 and VPC2, which means all advanced configuration options are selected
-
Access from multiple VPCs across regions
-
Log on to the CEN console and create a CEN instance.
-
Create transit routers in the corresponding regions. In this topic, the China (Shanghai) and China (Qingdao) regions are used.
-
On the transit routers, create network instance connections for the corresponding VPCs.
Connect VPC1 to the Enterprise Edition transit router in the China (Shanghai) region, and connect VPC3 to the Enterprise Edition transit router in the China (Qingdao) region.
-
Find the target CEN instance and click its ID. In the Actions column, click Create Connection.
-
On the Connection with Peer Network Instance page, configure the parameters described in the following table, and then click OK.
Configuration item
Description
VPC1
VPC3
Instance Type
Select the type of the network instance that you want to connect.
VPC
VPC
Region
Select the region where the network instance that you want to connect resides.
China (Shanghai)
China (Qingdao)
Transit Router
The system automatically displays the ID of the transit router instance that has been created in the region.
Account
Select the type of the account to which the network instance that you want to connect belongs.
Your Account
Your Account
Billing Method
Default valuePay-as-you-go.
Connection Name
Enter a name for the network instance connection.
VPC1 connection
VPC3 connection
Networks
Select the network instance that you want to connect.
Select VPC1
Select VPC3
vSwitch
Select a vSwitch instance in a zone supported by the transit router.
If you have vSwitch instances in multiple zones supported by the transit router, you can select multiple zones and select one vSwitch instance in each zone to implement zone-level disaster recovery.
-
Shanghai Zone F: Select vSwitch 1
-
Shanghai Zone G: Select vSwitch 2
-
Qingdao Zone H: Select vSwitch 1
-
Qingdao Zone I: Select vSwitch 2
Advanced Configuration
Keep the default settings for both VPC1 and VPC3, which means all advanced configuration options are selected.
-
-
-
Create an inter-region connection.
Because the Enterprise Edition transit router connected to VPC1 and the Enterprise Edition transit router connected to VPC2 reside in different regions, VPC instances in different regions cannot communicate with each other by default. You must create an inter-region connection between the Enterprise Edition transit router instances in the China (Qingdao) and China (Shanghai) regions to enable cross-region communication between VPC1 and VPC2.
-
On the CEN Instance page, find the target CEN instance and click its ID.
-
On the Basic Information > Transit Router tab, find any transit router instance. In its Actions column, click Create Connection.
-
On the Connection with Peer Network Instance page, configure the inter-region connection, and then click OK.
Configuration item
Description
Network Type
Select Inter-region Connection.
Region
Select the region that you want to connect.
In this topic, China (Qingdao).
Peer Region
Select the peer region that you want to connect.
In this topic, China (Shanghai).
Bandwidth Allocation Mode
Select the bandwidth allocation mode for the inter-region connection.
In this topic, Pay-By-Data-Transfer is selected. You are charged based on the actual traffic used by the inter-region connection.
Bandwidth
Enter the bandwidth value of the inter-region connection. Unit: Mbps.
In the Pay-By-Data-Transfer bandwidth allocation mode, this parameter specifies the bandwidth limit of the inter-region connection.
Default Line Type
Select the line type of the inter-region connection.
In this topic, the default value is used. For more information about line types, see Line types.
Advanced Settings
In this topic, the default settings are used, which means all three advanced features are enabled.
-
Configure routing rules for OpenSearch
Add a route for the OpenSearch service to the VPC1 route table to direct traffic from vpc2/vpc3 accessing OSS to the Enterprise Edition transit router. The vpc2 configuration below is the same-region example, and the vpc3 configuration is the cross-region example.
-
Log on to the VPC console and find the system route table of vpc2 (same-region connection) or vpc3 (cross-region connection).
-
In the custom route entries, add a route entry for 100.103.8.57, with the next hop pointing to the transit router instance.
-
Log on to the CEN console, and click the transit router instance in the China (Shanghai) region (same-region connection) or the China (Qingdao) region (cross-region connection) to go to its details page.
-
On the Route Table tab, click Add Route Entry to add a route entry for 100.103.8.57, with the next hop pointing to the transit router connection instance that corresponds to vpc1.
Verification
-
In the VPC console, find the vpc2/vpc3 instance and click "+" in the Elastic Compute Service column to create an ECS instance. After the instance is created, you can run the following curl command in the terminal to verify the result. Replace
{username},{password}, and{instanceId}with actual values.curl -i -u "{username}:{password}" http://{instanceId}.ha.aliyuncs.com/network/active
-
If the following result is returned, the network connection is established:
HTTP/1.1 200 OK Server: Tengine Date: Tue, 26 Nov 2024 08:29:34 GMT Content-Type: application/json; charset=utf-8 Content-Length: 0 Connection: keep-alive Keep-Alive: timeout=320 X-Request-Id: 037a9080181d0b90b8c99b25af7e****If a
403 Forbiddenerror is returned, it indicates a network issue. Contact us for support.