A route table contains a set of routes that are used to determine where network traffic from your subnets in a VPC is directed. Each subnet must be associated with a route table. A subnet can only be associated with one route table, but you can associate multiple subnets with the same route table.
The custom route table associated with a subnet affects only the outbound traffic. The default route table of a subnet controls the inbound traffic.
You can add routes to default and custom route tables and configure the destination, next hop type, and next hop in the routes to determine where network traffic is directed. Routes are classified into system routes and custom routes.
In addition to the preceding system routes, the system automatically adds a route whose destination is 127.0.0.0/8. This is the local loopback address.
You can add a custom route and configure the destination, next hop type, and next hop in the route to determine where network traffic is directed. Table 1 lists the supported types of next hops.
You cannot add two routes with the same destination to a VPC route table even if their next hop types are different. The route priority depends on the destination. According to the longest match routing rule, the destination with a higher matching degree is preferentially selected for packet forwarding.
Next Hop Type |
Description |
Supported Route Table |
---|---|---|
Server |
Traffic intended for the destination is forwarded to an ECS in the VPC. |
|
Extension NIC |
Traffic intended for the destination is forwarded to the extension NIC of an ECS in the VPC. |
|
BMS user-defined network |
Traffic intended for the destination is forwarded to a BMS user-defined network. Currently, this parameter is available only in eu-de. |
|
VPN connection |
Traffic intended for the destination is forwarded to a VPN gateway. |
Custom route table |
Direct Connect gateway |
Traffic intended for the destination is forwarded to a Direct Connect gateway. |
Custom route table |
NAT gateway |
Traffic intended for the destination is forwarded to a NAT gateway. |
|
VPC peering connection |
Traffic intended for the destination is forwarded to a VPC peering connection. |
|
Virtual IP address |
Traffic intended for the destination is forwarded to a virtual IP address and then sent to active and standby ECSs to which the virtual IP address is bound. |
|
If you specify the destination when creating a resource, a system route is delivered. If you do not specify a destination when creating a resource, a custom route that can be modified or deleted is delivered.
For example, when you create a NAT gateway, the system automatically delivers a custom route without a specific destination (0.0.0.0/0 is used by default). In this case, you can change the destination. However, when you create a VPN connection or Direct Connect gateway, you need to specify the remote subnet, that is, the destination of a route. In this case, the system delivers this system route. Do not modify the route destination on the Route Tables page. If you do, the destination will be inconsistent with the configured remote subnet. To modify the route destination, go to the specific resource page and modify the remote subnet, then the route destination will be changed accordingly.
Figure 2 shows the process of creating and configuring a custom route table.