All Products
Search
Document Center

Cloud Enterprise Network:Allow only specified VPCs to communicate with each other

Last Updated:Feb 27, 2026

By default, all virtual private clouds (VPCs) attached to a Cloud Enterprise Network (CEN) instance can communicate with each other. As your network grows, this full-mesh connectivity can become difficult to manage and may not meet your security requirements. This topic describes how to configure routing policies to restrict connectivity so that only specific VPCs can communicate.

Note

This feature is supported only by Basic Edition transit routers.

Deny-all-then-allow-specific pattern

This approach works like a firewall rule set:

  1. Deny all -- Create low-priority routing policies (priority 100) on each transit router to reject all VPC-bound routes. This blocks communication between all attached VPCs.

  2. Allow specific pairs -- Create higher-priority routing policies (priority 50) that allow routes between specific VPC pairs. Because these policies have a lower priority value (higher precedence), they override the deny-all policies for the specified VPCs.

To allow additional VPC pairs to communicate later, add more high-priority allow policies without modifying the existing deny-all policies.

Scenario

In this example, three VPCs are attached to the same CEN instance:

  • VPC1 and VPC2 are in the China (Hong Kong) region.

  • VPC3 is in the Germany (Frankfurt) region.

Goal: Allow only VPC1 and VPC3 to communicate. Block all other VPC-to-VPC communication, including VPC1-VPC2 and VPC2-VPC3.

Connectivity matrix

VPC1VPC2VPC3
VPC1--DeniedAllowed
VPC2Denied--Denied
VPC3AllowedDenied--

Network topology

指定VPC间互通

Prerequisites

Before you begin, make sure that you have:

Network details

VPCRegionCIDR blockvSwitch CIDRECS instance IP
VPC1China (Hong Kong)10.0.0.0/8vSwitch1: 10.0.1.0/24ECS1: 10.0.1.95
vSwitch2: 10.0.2.0/24ECS2: 10.0.2.120
VPC2China (Hong Kong)172.16.0.0/12172.16.1.0/24172.16.1.80
VPC3Germany (Frankfurt)192.168.0.0/16192.168.1.0/24192.168.1.151

Step 1: Create deny-all routing policies

Create two routing policies -- one on each regional transit router -- to block all VPC-bound routes. Both policies use the same configuration but apply to different regions.

To add a routing policy:

  1. Log on to the CEN console.

  2. On the Instances page, click the ID of the CEN instance.

  3. On the instance details page, click the ID of the transit router in the target region.

  4. On the transit router details page, click the Route Table tab, and then click Routing Policies.

  5. On the Routing Policies tab, click Add Routing Policy.

Deny-all policy for Germany (Frankfurt)

On the Add Routing Policy page, configure the following settings and click OK:

ParameterValue
Routing Policy Priority100
DescriptionVPCs in the Germany (Frankfurt) region reject routes from the transit router
RegionGermany (Frankfurt)
Policy DirectionEgress Regional Gateway
Match ConditionsDestination Instance Type: VPC
Action PolicyReject

Deny-all policy for China (Hong Kong)

Navigate back to the Routing Policies tab, click Add Routing Policy, and configure the following settings:

ParameterValue
Routing Policy Priority100
DescriptionVPCs in the China (Hong Kong) region reject routes from the transit routers
RegionChina (Hong Kong)
Policy DirectionEgress Regional Gateway
Match ConditionsDestination Instance Type: VPC
Action PolicyReject

Verify the deny-all policies

After you add both policies, click the Network Routes tab to confirm that VPC1, VPC2, and VPC3 all reject routes from the transit routers. The following screenshot shows VPC1 rejecting routes from the transit routers in the China (Hong Kong) and Germany (Frankfurt) regions.

查看VPC1路由

Step 2: Create allow policies for VPC1 and VPC3

To enable bidirectional communication between VPC1 and VPC3, create two allow policies -- one on each regional transit router. These policies have a higher priority (lower value) than the deny-all policies, so they take precedence for the specified VPC pair.

Allow VPC1 to receive routes from VPC3

Navigate to the routing policies page for the China (Hong Kong) transit router. Click Add Routing Policy and configure the following settings:

ParameterValue
Routing Policy Priority50
DescriptionAllow VPC1 to accept routes from VPC3
RegionChina (Hong Kong)
Policy DirectionEgress Regional Gateway
Match ConditionsSource Region: Germany (Frankfurt)
Source Instance ID List: ID of VPC3
Destination Instance ID List: ID of VPC1
Action PolicyAllow

After you add this policy, click the Network Routes tab to confirm that VPC1 now accepts routes from VPC3.

VPC1接受VPC3路由

Allow VPC3 to receive routes from VPC1

Navigate to the routing policies page for the Germany (Frankfurt) transit router. Click Add Routing Policy and configure the following settings:

ParameterValue
Routing Policy Priority50
DescriptionAllow VPC3 to accept routes from VPC1
RegionGermany (Frankfurt)
Policy DirectionEgress Regional Gateway
Match ConditionsSource Region: China (Hong Kong)
Source Instance ID List: ID of VPC1
Destination Instance ID List: ID of VPC3
Action PolicyAllow

After you add this policy, click the Network Routes tab to confirm that VPC3 now accepts routes from VPC1.

VPC3接受VPC1路由

Routing policy summary

The following table lists all routing policies created in this example:

RegionPriorityDirectionMatch conditionActionPurpose
Germany (Frankfurt)100Egress Regional GatewayDestination Instance Type = VPCRejectBlock all VPC communication in Frankfurt
China (Hong Kong)100Egress Regional GatewayDestination Instance Type = VPCRejectBlock all VPC communication in Hong Kong
China (Hong Kong)50Egress Regional GatewaySource Region = Frankfurt, Source = VPC3, Destination = VPC1AllowVPC1 receives VPC3 routes
Germany (Frankfurt)50Egress Regional GatewaySource Region = Hong Kong, Source = VPC1, Destination = VPC3AllowVPC3 receives VPC1 routes

Step 3: Test connectivity

Log on to the ECS instances and run ping commands to verify the routing policies work as expected.

Test 1: VPC1 to VPC3 (expected: success)

  1. Log on to ECS1 in VPC1.

  2. Ping the ECS instance in VPC3:

    ping 192.168.1.151

    VPC1 can reach the ECS instance in VPC3. This confirms that VPC1 and VPC3 can communicate. pingVPC3

Test 2: VPC2 to VPC1 (expected: failure)

  1. Log on to the ECS instance in VPC2.

  2. Ping ECS1 in VPC1:

    ping 10.0.1.95

    The ping fails. This confirms that VPC2 cannot communicate with VPC1. VPC2访问VPC1

Test 3: VPC3 to VPC2 (expected: failure)

  1. Log on to the ECS instance in VPC3.

  2. Ping the ECS instance in VPC2:

    ping 172.16.1.80

    The ping fails. This confirms that VPC3 cannot communicate with VPC2. pingVPC3-2

Troubleshooting

SymptomPossible causeSolution
VPCs still communicate after adding deny-all policiesIncorrect policy configurationVerify that the Policy Direction is set to Egress Regional Gateway and the Destination Instance Type is set to VPC. Make sure you created deny-all policies on both regional transit routers.
VPCs cannot communicate after adding allow policiesIncorrect priority or VPC IDsVerify that the priority value of the allow policies (50) is lower than the deny-all policies (100). A lower value means higher precedence. Check that the Source Instance ID List and Destination Instance ID List contain the correct VPC IDs.
Unexpected routing behaviorPolicy evaluation order misunderstandingPolicies are evaluated from the lowest priority value (highest precedence) to the highest. When a route matches a policy, the action is applied and no further policies are evaluated for that route.