A Route Table determines the Forwarding Path for Network Traffic within a Virtual Private Cloud (VPC). You can configure Routes in the table to direct Packets from a Source, such as an ECS Instance, to a Destination.
Features
Route tables
When you create a Virtual Private Cloud (VPC), the system automatically creates a System Route Table. By default, this route table is associated with all vSwitches in the VPC and controls traffic within the VPC.
If different Elastic Compute Service (ECS) instances in a VPC need to use different network paths to access the same destination CIDR block, you can use a Custom Route Table. By deploying the ECS instances on different vSwitches and associating a unique Custom Route Table with each vSwitch, you can achieve fine-grained traffic control.
To protect inbound Internet traffic to your VPC with a self-managed firewall, you can use a Gateway Route Table, which is a type of Custom Route Table associated with a Border Gateway. By associating the Gateway Route Table with an IPv4/IPv6 Gateway, you can direct inbound Internet traffic to a self-managed firewall for centralized filtering, auditing, and security policy management.
The following table compares the different types of route tables.
Feature | System Route Table | Custom Route Table | |
Associated object | vSwitch | vSwitch | IPv4/IPv6 Gateway |
Diagram | |||
Use cases | Associates with all new vSwitches by default to centrally control their traffic. | Associates with specific vSwitches to control their individual traffic flow. | Associates with an IPv4/IPv6 Gateway to securely redirect inbound Internet traffic. |
Creation method | Created automatically when you create a VPC. | Created manually. Select vSwitch as the route table type. | Created manually. Select Border Gateway as the route table type. |
Deletion | Cannot be deleted. | Can be deleted. You must first disassociate it from the vSwitch. | Can be deleted. You must first disassociate it from the IPv4/IPv6 Gateway. |
Quota | One System Route Table per VPC. | By default, a VPC supports up to nine Custom Route Tables associated with vSwitches. You can request a quota increase. | A VPC supports only one route table associated with an IPv4/IPv6 Gateway. |
Each vSwitch must be associated with exactly one Route Table. A single Route Table can be associated with multiple vSwitches.
Routes
A route is an entry in a Route Table. It defines the Next Hop, such as a NAT Gateway or an ECS Instance, that forwards traffic to a specific Destination CIDR Block.
Routes in a VPC are classified into two types:
1. Static Routes: System-added or user-added routes.
2. Dynamic Routes: Routes that are propagated to a VPC from other network instances, such as a Transit Router (TR) or VPN Gateway.
1. Static routes
Static routes include two types:
System Route: A route with a Next Hop of
Local. The system automatically adds this type of route when you create a VPC and a vSwitch. These routes are used for communication between instances within the VPC or to access Alibaba Cloud services.Custom Route: A route that you manually add to customize traffic paths.
As shown in the following figure, two VPCs are connected through a VPC Peering Connection. The System Route Table of VPC1 contains the following static routes:
After you create a VPC and a vSwitch, the system automatically adds System Routes with the Next Hop set to
Local:Alibaba Cloud service route: The Destination CIDR Block is
100.64.0.0/10. This route allows instances in VPC1 to access Alibaba Cloud services.vSwitch route: The Destination CIDR Block is
10.0.0.0/24. This route allows private communication between vSwitches in VPC1.
After you create the VPC Peering Connection, you must manually add the following Custom Route:
The Destination CIDR Block is
172.16.0.0/16and the Next Hop is theVPC Peering Connection. This route forwards traffic destined forVPC2to the VPC Peering Connection.
The routes in the System Route Table of VPC2 follow the same principle as those in VPC1 and are not described further.
System routes vs. custom routes
Item | System route | Custom route |
Definition | A route with a Next Hop of | A route that you manually add. |
IPv4 route | The system automatically adds the following routes to all route tables in the VPC:
| You can manually add the following routes:
|
IPv6 route | If IPv6 is enabled for the VPC, the system automatically adds the following route to all route tables in the VPC:
| If IPv6 is enabled for the VPC, you can add routes with the following parameters:
|
Can the Next Hop be changed? |
| If a Custom Route was created by changing the Next Hop of a System Route, the Next Hop of this Custom Route can be changed only to Local, an ECS Instance, an ENI, or a Gateway Load Balancer Endpoint. |
Can it be manually created? | You cannot manually create or delete System Routes. | You can create and delete them. |
2. Dynamic routes
Dynamic routes are routes propagated to a VPC from other network instances. Unlike static routes, you do not need to manually configure dynamic routes in the VPC Route Table. They are automatically learned and updated from dynamic route sources.
2.1 Dynamic route sources
Network instances that automatically propagate routes to a VPC include Enterprise Edition Transit Routers (TRs), Basic Edition Transit Routers (TRs), VPN Gateways, and Express Connect Routers (ECRs). You can view the source and details of dynamic routes on the tab of the Route Table details page in the console.
The details of routes received from an Enterprise Edition TR are displayed on the tab.
2.2 Enable or disable dynamic route receiving
By default, all Route Tables receive dynamic routes. If you require a purely static routing configuration, you can disable dynamic route receiving for a specific Route Table. This allows for flexible management of your routing configurations.
2.3 Dynamic route limitations
A VPC Route Table can receive dynamic routes from only one dynamic route source at a time.
For example, after you associate a VPC with an ECR and then connect it to an Enterprise Edition TR, an attempt to enable route synchronization for the VPC on the TR will fail. Similarly, after you create a VPN Gateway and enable automatic BGP route propagation, BGP routes learned by the VPN Gateway are automatically propagated to the System Route Table of the VPC. In this state, you cannot associate the VPC with an ECR.
If a received dynamic route overlaps with an existing route in the Route Table, see Route Priority to determine which route takes precedence.
Only Route Tables associated with vSwitches can receive dynamic routes. Route Tables associated with gateways do not support dynamic routes.
By default, a single Route Table supports a maximum of 200 active dynamic routes from an ECR. Routes that exceed this quota are received but remain inactive. When you increase the quota, the new limit applies on the next route propagation. Inactive routes are then enabled in the order they were received.
Route priority
Routes in a VPC Route Table are prioritized as follows:
When routes with overlapping Destination CIDR Blocks exist:
IPv4 and IPv6 traffic are routed independently. The system uses the Longest Prefix Match rule to select the most specific route that matches the destination IP address. This determines the Next Hop for traffic forwarding.
Longest Prefix Match: When multiple routes have Destination CIDR Blocks that match a packet's destination IP address, the system uses the route with the longest subnet mask (the most specific network range). For example, traffic destined for
192.168.1.100matches the192.168.1.0/24route before it matches the192.168.0.0/16route.When the Destination CIDR Block of a new route overlaps with that of an existing route:
Actions
Existing system route
Existing custom route
Existing dynamic route
Create a vSwitch
The CIDR block of the vSwitch cannot overlap with an existing System Route.
The CIDR block of the vSwitch cannot:
Be identical to the Destination CIDR Block of an existing Custom Route.
Contain the Destination CIDR Block of an existing Custom Route.
The CIDR block of the vSwitch cannot:
Be identical to the Destination CIDR Block of an existing Dynamic Route.
Contain the Destination CIDR Block of an existing Dynamic Route.
Add a Custom Route
The Destination CIDR Block of the new Custom Route cannot:
Be identical to the CIDR block of an existing System Route.
Be more specific than an existing System Route.
The Destination CIDR Block of the new Custom Route cannot be identical to that of an existing Custom Route.
If the Next Hop type is router interface (to VBR), you can configure active/standby or equal-cost multi-path (ECMP) routes. For more information, see Route to a router interface.
When you add a Custom Route, its Destination CIDR Block cannot be identical to that of an existing Dynamic Route.
If the Next Hop of the new Custom Route is a VPN Gateway or router interface, and an existing Dynamic Route from CEN has the same Destination CIDR Block, the Dynamic Route is withdrawn and the Custom Route takes effect.
Receive a dynamic route
Cannot have the same Destination CIDR Block as an existing System Route.
If it is more specific than an existing System Route, the dynamic route does not take effect:
If the route source is an ECR, the dynamic route is displayed in the VPC Route Table but does not take effect.
If the route source is a VPN Gateway, Enterprise Edition Transit Router (TR), or Basic Edition Transit Router (TR), the dynamic route is not propagated to the VPC Route Table.
If it has the same Destination CIDR Block as an existing Custom Route, the dynamic route does not take effect.
If the route source is an ECR, the dynamic route is displayed in the VPC Route Table but does not take effect.
If the route source is a VPN Gateway, Enterprise Edition Transit Router (TR), or Basic Edition Transit Router (TR), the dynamic route is not propagated to the VPC Route Table.
After the Custom Route is deleted, the dynamic route automatically takes effect.
Not supported. The current VPC Route Table has only one route propagation source.
Manage route tables
When you create a Virtual Private Cloud (VPC), the system automatically creates a System Route Table. By default, this route table is associated with all vSwitches to control their traffic.
To control traffic for a specific vSwitch in a VPC, create a Custom Route Table of the vSwitch type and associate it with the vSwitch.
To control inbound traffic from the Internet to a VPC, create a Custom Route Table of the Border Gateway type and then associate it with an IPv4/IPv6 Gateway.
Create and delete route tables
Create a Custom Route Table before you associate it with a vSwitch or an IPv4/IPv6 Gateway.
Console
Create a route table
Navigate to the Route Tables page in the VPC console and click Create Route Table.
Select the target VPC, enter a Name, and select an Object Type to associate:
vSwitch: After you associate this route table with a vSwitch, you can control the traffic path for that specific vSwitch.
Border Gateway: After you associate this route table with an IPv4/IPv6 Gateway, you can control the path of inbound traffic from the Internet to the VPC.
After you create a Custom Route Table, the system automatically adds the following system Route Entries:
vSwitch CIDR block route: A Route Entry whose destination is the CIDR block of any vSwitch in the VPC. This Route Entry enables communication among instances within the VPC.
Cloud service route: A Route Entry whose destination CIDR block is
100.64.0.0/10. This Route Entry allows instances in the VPC to access Alibaba Cloud services.
Delete a route table
In the Actions column of the target Route Table or on its details page, click Delete. Before deleting a Route Table, ensure it is unassociated from all resources and all its custom Route Entries are deleted.
Only Custom Route Tables can be deleted. System Route Tables cannot be deleted.
API
Call CreateRouteTable to create a Route Table.
Call DeleteRouteTable to delete a Custom Route Table.
Terraform
Resources: alicloud_route_table
variable "name" {
default = "terraform-example"
}
resource "alicloud_vpc" "defaultVpc" {
vpc_name = var.name
}
resource "alicloud_route_table" "default" {
description = "test-description"
vpc_id = alicloud_vpc.defaultVpc.id
route_table_name = var.name
associate_type = "VSwitch"
}Associate and unassociate route tables
By default, a new Custom Route Table is not associated with any resource. You must associate it with a vSwitch or an IPv4/IPv6 Gateway for it to take effect.
Console
Associate a route table
Navigate to the Route Tables page in the VPC console. In the Associated Resource column of the target Route Table, click Associate.
If the route table's Object Type is vSwitch: Click Associate vSwitch, and then select the target vSwitch in the dialog box that appears.
When you associate a vSwitch with a Custom Route Table, the system automatically unassociates it from the System Route Table.
If the route table's Object Type is Border Gateway: Click Associate Border Gateway, and then select the target IPv4 Gateway or IPv6 Gateway in the dialog box that appears.
For a tutorial on using a Route Table that is associated with a Border Gateway, see Use a gateway route table to control inbound traffic to a VPC.
Unassociate a route table
Navigate to the details page of the target Route Table.
If the route table's Object Type is vSwitch: On the tab, select the vSwitches to unassociate, and then click Unassociate. After a vSwitch is unassociated, it automatically re-associates with the System Route Table.
If the route table's Object Type is Border Gateway: On the tab, find the IPv4/IPv6 Gateway and click Unassociate in the Actions column.
Before you unassociate a Route Table, assess the potential impact of the route changes to avoid service disruptions.
API
Call AssociateRouteTable to associate a Route Table with a vSwitch.
Call AssociateRouteTableWithGateway to associate a Route Table with an IPv4/IPv6 Gateway.
Before you unassociate a Route Table, assess the potential impact of the route changes to avoid service disruptions.
Call UnassociateRouteTable to unassociate a Route Table from a vSwitch.
Call DissociateRouteTableFromGateway to dissociate a Route Table from an IPv4/IPv6 Gateway.
Terraform
Associate a route table with a vSwitch
Resources: alicloud_route_table_attachment
Data Sources: alicloud_zones
variable "name" {
default = "terraform-example"
}
resource "alicloud_vpc" "foo" {
cidr_block = "172.16.0.0/12"
vpc_name = var.name
}
data "alicloud_zones" "default" {
available_resource_creation = "VSwitch"
}
resource "alicloud_vswitch" "foo" {
vpc_id = alicloud_vpc.foo.id
cidr_block = "172.16.0.0/21"
zone_id = data.alicloud_zones.default.zones[0].id
vswitch_name = var.name
}
resource "alicloud_route_table" "foo" {
vpc_id = alicloud_vpc.foo.id
route_table_name = var.name
description = "route_table_attachment"
}
resource "alicloud_route_table_attachment" "foo" {
vswitch_id = alicloud_vswitch.foo.id
route_table_id = alicloud_route_table.foo.id
}Associate a route table with a gateway
Resources: alicloud_vpc_gateway_route_table_attachment
resource "alicloud_vpc" "example" {
cidr_block = "172.16.0.0/12"
vpc_name = "terraform-example"
}
resource "alicloud_route_table" "example" {
vpc_id = alicloud_vpc.example.id
route_table_name = "terraform-example"
description = "terraform-example"
associate_type = "Gateway"
}
resource "alicloud_vpc_ipv4_gateway" "example" {
ipv4_gateway_name = "terraform-example"
vpc_id = alicloud_vpc.example.id
enabled = true
}
resource "alicloud_vpc_gateway_route_table_attachment" "example" {
ipv4_gateway_id = alicloud_vpc_ipv4_gateway.example.id
route_table_id = alicloud_route_table.example.id
}Manage route entries
Add and delete a route entry
You can add a Custom Route to a Route Table for a VSwitch to control its traffic path.
You cannot add a Route Entry to a Route Table that is associated with an IPv4 or IPv6 gateway, but you can change the next hop of a Route Entry.
Console
Add a route entry
Go to the details page of the target
Route Table. On the tab, click Add Route Entry.In the Add Route Entry dialog box, set the Destination CIDR Block and Next Hop Type. For information about typical scenarios for different
Next Hoptypes, see Configuration examples.If you encounter an error when adding the
Route Entry, check whether the configuration meets the route priority requirements.
Delete a route entry
In the Actions column of the target Route Entry, click Delete.
Before deleting a Route Entry, fully assess the business impact to avoid service disruptions.
API
Use the CreateRouteEntry operation to add a single
Route Entryand the CreateRouteEntries operation to addRoute Entriesin batches.
Before deleting a Route Entry, fully assess the business impact to avoid service disruptions.
Use the DeleteRouteEntry operation to delete a single
Custom Routeand the DeleteRouteEntries operation to deleteCustom Routesin batches.
Terraform
Resource: alicloud_route_entry
resource "alicloud_route_entry" "foo" {
route_table_id = "rt-12345xxxx" # Specify the route table ID.
destination_cidrblock = "172.16.1.1/32"
nexthop_type = "Instance" # Specify the next hop type.
nexthop_id = "i-12345xxxx" # Specify the next hop instance ID.
}Change the next hop
You can change the Next Hop of a Route Entry to change the traffic path for the Destination CIDR Block.
System Route: You can change theNext Hopof aSystem Routeonly if it is in a customRoute Table(including a gatewayRoute Table). After the change, theRoute Entrybecomes aCustom Route. If you delete thisCustom Route, the originalSystem Routeis restored.Custom Route: You can change theNext Hopof aCustom Routein both system and customRoute Tables.
For information about the supported types for Destination CIDR Block and Next Hop, see System routes vs. custom routes.
Before changing the Next Hop of a Route Entry, fully assess the business impact to avoid service disruptions.
Console
In the Actions column of the target Route Entry, click Edit. In the dialog box that appears, select a new Next Hop from the Next Hop Type drop-down list.
For information about typical scenarios for different Next Hop types, see Configuration examples.
API
Call the ModifyRouteEntry operation to change the
Next Hopof aRoute Entryin aRoute Tableassociated with aVSwitch.Call the UpdateGatewayRouteTableEntryAttribute operation to change the
Next Hopof aRoute Entryin aRoute Tableassociated with an IPv4/IPv6 gateway.
Publish and withdraw a static route
Route Entries in a Route Table can be published to an Express Connect Router (ECR) or a Transit Router (TR). Combined with Dynamic Route Receiving, this feature simplifies your route configuration.
Publish static routes to an Express Connect Router (ECR): After a static route is published to an ECR, the ECR dynamically propagates the route to an on-premises data center. If noRoute Conflictexists, all on-premises data centers associated with the ECR can learn this route.Publish static routes to a Transit Router (TR): After a static route is published to a
Transit Router, if noRoute Conflictexists androute synchronizationis enabled for the TR, all network instances connected to the TR learn this route.
If your Virtual Private Cloud is connected to both an ECR and a TR, publishing Route Entries to the ECR and to the TR are independent of each other.
Console
Publish a static route entry
In the Route Advertisement Status column of the target Route Entry, click Publish.
The Route Advertisement Status column is displayed in the console only after the Virtual Private Cloud is connected to a TR or an ECR.Withdraw a published static route entry
In the Route Advertisement Status column of the target Route Entry, click Withdraw.
The Route Advertisement Status column is displayed in the console only after the Virtual Private Cloud is connected to a TR or an ECR.API
For an ECR:
Call the PublishVpcRouteEntries operation to publish static
Route Entriesto an ECR.Call the WithdrawVpcPublishedRouteEntries operation to withdraw
Route Entriesthat have been published to an ECR.
For a TR:
Call the PublishRouteEntries operation to publish static
Route Entriesto a TR.Call the WithdrawPublishedRouteEntries operation to withdraw
Route Entriesthat have been published to a TR.
Tab body
Enable and disable dynamic route receiving
By default, all Route Tables receive dynamic routes. If you require a purely static routing configuration, you can disable Dynamic Route Receiving for a specific Route Table to manage your routing configurations as needed.
You can disable
Dynamic Route Receivingif the dynamic route source is Route Propagation-Type ECR, or no dynamic routes are propagated to theVirtual Private Cloud. If no dynamic routes are propagated to theVirtual Private Cloud, Dynamic Route Source is not displayed on the Route Entry List > Dynamic Route tab of theRoute Tabledetails page.You cannot disable
Dynamic Route Receivingin the following cases: TheVirtual Private Cloudis connected to a Basic Edition TR. TheVirtual Private Cloudis connected to an Enterprise Edition TR and route synchronization is enabled for theVirtual Private Cloudon the TR. TheVirtual Private Cloudis associated with aVPN Gatewayand automatic BGP route propagation is enabled for theVPN Gateway.Impact of disabling the feature:
The
Virtual Private CloudRoute Tableno longer receives routes propagated from other network instances. If dynamic routes exist in theRoute Table, the system deletes them. Proceed with caution.The
Virtual Private Cloudcannot be connected to a Basic Edition TR. A TR connected to thisVirtual Private Cloudcannot enableroute synchronizationfor theVirtual Private Cloud. You cannot enableautomatic BGP route propagationfor aVPN Gatewayassociated with thisVirtual Private Cloud.
Impact of re-enabling the feature after it is disabled:
After you re-enable the feature, the system updates the dynamic routes in the
Virtual Private CloudRoute Tablebased on the routes propagated from the dynamic route source.For example, assume that an ECR has four dynamic routes. If you disable this feature, the dynamic routes are cleared from the
Virtual Private CloudRoute Table. If two moreRoute Entriesare added to the ECR and you then re-enable this feature, theVirtual Private CloudRoute Tablereceives six dynamic routes from the ECR.
Console
Navigate to the Route Table Details page of the target Route Table. Use the Accept Advertised Routes switch to enable or disable Dynamic Route Receiving.
Before enabling or disabling Dynamic Route Receiving, fully assess the business impact of the route changes to avoid service disruptions.
API
Call ModifyRouteTableAttributes and modify the RoutePropagationEnable parameter to enable or disable dynamic route receiving.
Before enabling or disabling Dynamic Route Receiving, fully assess the business impact of the route changes to avoid service disruptions.
Terraform
Before enabling or disabling Dynamic Route Receiving, fully assess the business impact of the route changes to avoid service disruptions.
Resource: alicloud_route_table
variable "name" {
default = "terraform-example"
}
resource "alicloud_vpc" "defaultVpc" {
vpc_name = var.name
}
resource "alicloud_route_table" "default" {
description = "test-description"
vpc_id = alicloud_vpc.defaultVpc.id
route_table_name = var.name
associate_type = "VSwitch"
route_propagation_enable = true # Modify this parameter to enable or disable Dynamic Route Receiving.
}Use a gateway route table
A Gateway Route Table lets you direct Inbound Internet Traffic to a Security Device for deep inspection and filtering. This helps prevent malicious attacks and unauthorized access. You can also combine a Gateway Route Table with a Custom Route Table to redirect outbound traffic to a Security Device.
To use this feature, create a route table and associate it with an IPv4 Gateway. Then, change the Next Hop of the system route for the vSwitch CIDR block in the route table to one of the following:
ECS Instance/Elastic Network Interface (ENI): Redirects internet traffic to a specific ECS Instance or ENI for security inspection.
Gateway Load Balancer Endpoint (GWLBe): Redirects internet traffic to third-party security devices through a Gateway Load Balancer (GWLB).
Only these regions support changing the Next Hop to a Gateway Load Balancer Endpoint (GWLBe).
Using a self-managed firewall
You can deploy a self-managed firewall on an ECS Instance in a Virtual Private Cloud (VPC) and use a Gateway Route Table to redirect traffic that enters the VPC to the firewall for filtering.
GWLB high-availability architecture
You can use a Gateway Load Balancer (GWLB) to distribute traffic among different security devices to improve the security and availability of your applications.
Configuration examples
Different next hop types apply to different scenarios:
Route to an IPv4 Gateway
You can use an IPv4 Gateway as a unified ingress and egress point for traffic between your Virtual Private Cloud (VPC) and the internet. When used with a custom route table, an IPv4 Gateway enables centralized control of internet access traffic. This setup helps you implement uniform security policies and simplifies auditing, reducing the security risks of distributed access points.
Route to an IPv6 Gateway
After you enable IPv6 for a Virtual Private Cloud (VPC), the system automatically adds a route to the system route table:
The destination CIDR block is
::/0and the next hop is the IPv6 Gateway.
This route directs default IPv6 traffic to the IPv6 Gateway. After you enable public bandwidth for an IPv6 address, vSwitches associated with the system route table can communicate with the internet.
For an IPv6-enabled vSwitch associated with a custom route table, you must manually add the preceding route to the custom route table to enable IPv6 internet access.
For a custom route where the next hop is an IPv6 Gateway, the destination CIDR block must be ::/0.Route to an Internet NAT Gateway
If you have many servers that initiate connections to the internet, you can use the source network address translation (SNAT) feature of an Internet NAT Gateway. This lets multiple ECS instances in your Virtual Private Cloud (VPC) to share Elastic IP addresses (EIPs) for internet access. This setup saves public IP resources and reduces security risks by not exposing their private IP addresses.
To enable internet access through an Internet NAT Gateway, you must add a custom route to the VPC route table that directs traffic to the gateway.
If the VSwitch of an ECS instance is associated with a custom route table, you must manually configure a route entry where the Destination CIDR Block is
0.0.0.0/0and the Next Hop is the Internet NAT Gateway.If the ECS instance's vSwitch is associated with the system route table:
If no route with the destination CIDR block
0.0.0.0/0exists in the system route table, the system automatically adds a route pointing to the Internet NAT Gateway.If a route with the destination CIDR block
0.0.0.0/0already exists in the system route table, you must first delete the existing route and then add a new route pointing to the Internet NAT Gateway.
- Public vSwitch 10.0.1.0/24
- VPC 10.0.0.0/16
- ...
- Internet
- next hop
- NAT Gateway
- Destination CIDR
- Elastic IP (EIP)
- Private vSwitch route table
- Elastic IP (EIP)
- ECS 2
- Private vSwitch 2 10.0.3.0/24
- 0.0.0.0/0
- Private vSwitch 1 10.0.2.0/24
- NAT Gateway
- ECS 1
Route to a VPC Peering Connection
VPCs are isolated from each other, but you can use a VPC Peering Connection to enable private communication between two VPCs in the same or different accounts and regions. After a peering connection is established between two VPCs, cloud resources deployed in the VPCs can access each other by using private IPv4 or IPv6 addresses.
Route to a Transit Router
When you use Cloud Enterprise Network (CEN) to connect VPCs, you must add routes that point to the Transit Router to the VPC route tables. You can do this in one of the following ways:
When you create a VPC connection, select Automatically Create Route That Points to Transit Router and Add to All Route Tables of Current VPC.
After you enable this feature, the system automatically adds three routes to all route tables of the VPC. The destination CIDR blocks of these routes are 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16. The next hop for these routes is the VPC connection, which directs IPv4 traffic from the VPC to the Transit Router.
After you enable route learning on the Transit Router, you can either enable route synchronization for each VPC or manually add a route in each VPC route table that points to the peer VPC.
The following figure shows an example where a route is manually added to the VPC route table after route learning is enabled on the Transit Router. The route's destination CIDR block is the CIDR block of the peer VPC, and its next hop is the Transit Router.
Route to a VPN Gateway
Use a VPN Gateway to establish a secure and reliable encrypted tunnel between an on-premises data center and your VPC.
When you use a VPN Gateway, you must add a route to the VPC. In this route, set the Destination CIDR block to the CIDR block of the on-premises data center and set the next hop to the VPN Gateway. This lets the VPC access the on-premises data center through an IPsec-VPN connection.
Route to an ECS instance or ENI
When two vSwitches in a VPC need to communicate, you can adjust the route tables to insert a third-party security device, such as a firewall or a Web Application Firewall (WAF), into the traffic path to inspect, analyze, and protect traffic.
To configure this, associate each communicating vSwitch with a separate custom route table. Then, change the next hop of the system route for the corresponding CIDR block to the ECS instance or Elastic Network Interface (ENI) of the firewall.
Route to a router interface
The VBR-to-VPC connection feature of Express Connect lets you connect your on-premises data center to your VPC.
The VBR-to-VPC connection feature is not enabled by default. To use it, contact your account manager.
When you use this feature, you must add a route to the VPC. In this route, set the destination CIDR block to the CIDR block of the on-premises data center and set the next hop type to router interface (to VBR). This allows the VPC to access the on-premises data center through the Virtual Border Router (VBR). This next hop type supports Equal-Cost Multi-Path (ECMP) and active/standby modes. You must use these modes with health check:
active/standby: You can specify only two instances as next hops. The weight of the active route's next hop is 100, and the weight of the standby route's next hop is 0. If the active route's health check fails, the standby route takes over.
ECMP: You can specify 2 to 16 instances as next hops. Each instance must have the same weight, an integer from 0 to 255. The system evenly distributes traffic among the next hop instances.
The following figure shows the active/standby mode:
Route to an Express Connect Router
You can use an Express Connect Router (ECR) with Express Connect to connect your on-premises data center to your VPC.
By default, a VPC accepts dynamic routes from an ECR. For these routes, the destination CIDR block is the CIDR block of the on-premises data center and the next hop is the ECR. This configuration enables communication between the VPC and the on-premises data center.
If dynamic route receiving is disabled for the VPC route table, you must manually add a route to the VPC route table. In this route, set the Destination CIDR block to the CIDR block of the on-premises data center and set the next hop to the Express Connect Router. This enables communication between the VPC and the on-premises data center.
Route to a Gateway Load Balancer endpoint
The Gateway Load Balancer endpoint next hop type is available only in these regions. For specific use cases, see Use a gateway route table - GWLB high-availability architecture.
Reference
Area | Regions that support custom route tables |
Asia-Pacific - China | China (Hangzhou), China (Shanghai), China (Nanjing - Local Region - Decommissioning), China (Qingdao), China (Beijing), China (Zhangjiakou), China (Hohhot), China (Ulanqab), China (Shenzhen), China (Heyuan), China (Guangzhou), China (Chengdu), China (Hong Kong), China (Wuhan - Local Region), China (Fuzhou - Local Region - Decommissioning) |
Asia-Pacific - Other | Japan (Tokyo), South Korea (Seoul), Singapore, Malaysia (Kuala Lumpur), Indonesia (Jakarta), Philippines (Manila), Thailand (Bangkok) |
Europe and Americas | Germany (Frankfurt), UK (London), US (Silicon Valley), US (Virginia), Mexico |
Middle East | UAE (Dubai), SAU (Riyadh - Partner Region) |
Quotas
Quota name | Description | Default limit | Adjustable |
vpc_quota_route_tables_num | Custom route tables per VPC. | 9 | Yes. Go to the Quota Management page or Quota Center to request a quota increase. |
vpc_quota_route_entrys_num | Custom route entries per route table (excluding dynamically propagated route entries). | 200 | |
vpc_quota_dynamic_route_entrys_num | Dynamically propagated routes per table. | 500 | |
vpc_quota_havip_custom_route_entry | Maximum custom routes pointing to HaVip. | 5 | |
vpc_quota_vpn_custom_route_entry | Maximum custom routes pointing to VPN gateway. | 50 | |
None | Tags per route table. | 20 | No. |
vRouters per VPC. | 1 | ||
Routes pointing to TR connection. | 600 |
Limits
Route table limits
A vSwitch must be associated with exactly one Route Table, while a Route Table can be associated with multiple vSwitches.
You can delete Custom Route Tables, but not System Route Tables.
Route limits
Static Route limits:
You cannot manually create or delete System Routes.
You can create a Custom Route with a Destination CIDR Block that is more specific than, but not the same as, the 100.64.0.0/10 system Route for Alibaba Cloud services. Use caution when configuring these Routes, as misconfigurations can disrupt access to some Alibaba Cloud services.
For a custom route whose next hop is an IPv6 Gateway instance, the destination CIDR block can only be set to
::/0.The console displays the Route Advertisement Status column only after the VPC is connected to a Transit Router (TR) or an Express Connect Router (ECR).
Adding a new Route may fail if its Destination CIDR Block overlaps with an existing Route. For more information, see Route priority.
Static Route publishing limits:
Route Entriesthat are configured in a customVirtual Private CloudRoute Tablecannot be published to an ECR.A
Route EntrywhoseDestination CIDR Blockis a prefix list cannot be published to an ECR.Active/standby routes and Equal-Cost Multi-Path (ECMP) routes whose
Next Hopis a router interface (to VBR) cannot be published to an ECR. After aVirtual Private Cloudroute is published to an ECR, you can no longer configure ECMP or active/standby routes for thatRoute Entry.After a
Virtual Private Cloudroute is published to an ECR, if you modify theRoute Entry, you can set theNext Hoponly to a type that supports publishing, as described in the following table.The following table lists the default advertisement status for different types of
Route Entriesand indicates whetherPublishandWithdrawoperations are supported.
Dynamic Route limits:
A VPC Route Table can receive dynamic routes from only one dynamic route source at a time.
For example, after you associate a VPC with an ECR and then connect it to an Enterprise Edition TR, an attempt to enable route synchronization for the VPC on the TR will fail. Similarly, after you create a VPN Gateway and enable automatic BGP route propagation, BGP routes learned by the VPN Gateway are automatically propagated to the System Route Table of the VPC. In this state, you cannot associate the VPC with an ECR.
If a received dynamic route overlaps with an existing route in the Route Table, see Route Priority to determine which route takes precedence.
Only Route Tables associated with vSwitches can receive dynamic routes. Route Tables associated with gateways do not support dynamic routes.
By default, a single Route Table supports a maximum of 200 active dynamic routes from an ECR. Routes that exceed this quota are received but remain inactive. When you increase the quota, the new limit applies on the next route propagation. Inactive routes are then enabled in the order they were received.
Billing
Route Tables are a free feature of VPC.