Updated on 2025-08-01 GMT+08:00

Adding Routes to a Route Table

Scenarios

Each route table comes with a default route, which is used to allow instances in a subnet to access public services on the cloud or different subnets in a VPC to communicate with each other. You can also add custom routes as required to control traffic routing.

If a route table is associated with a subnet, adding rules to the route table may affect how and where traffic is directed. Be careful with this operation as it may interrupt services.

Notes and Constraints

  • Generally, the destination of a custom route cannot overlap with that of a local route. The destination of a local route can be a subnet CIDR block or CIDR blocks that are used for internal communications.

    For example, if VPC-A has a subnet that supports IPv4/IPv6 dual stack. Its IPv4 CIDR block is 192.168.2.0/24 and IPv6 CIDR block is 2407:c080:802:be7::/64. The system automatically adds the local routes in Table 1 to the route table of VPC-A. In this case, the destinations of the custom routes you set cannot overlap with those of the existing local routes.

    Table 1 VPC-A local routes

    Local Route Destination

    Description

    192.168.2.0/24

    IPv4 CIDR block of the subnet

    2407:c080:802:be7::/64

    IPv6 CIDR block of the subnet

    100.64.0.0/10

    Network used by public services on the cloud, such as DNS

    198.19.128.0/20

    Network used by internal services, such as VPC Endpoint

    127.0.0.0/8

    Loopback address

  • You cannot add two routes with the same destination to a VPC route table even if their next hop types are different.

Procedure

  1. Go to the route table list page.
  2. Locate the target route table and click its name.

    The route table details page is displayed.

  3. Click Add Route and set parameters as prompted.

    You can click to add more routes.

    Table 2 Parameter descriptions

    Parameter

    Description

    Example Value

    Destination Type

    Mandatory

    The destination type can only be IP address. You can set an IP address or CIDR block.

    IP address

    Destination

    Mandatory

    Enter the destination of the route. You can enter a single IP address or an IP address range in CIDR notation.

    The destination of the default route is 0.0.0.0/0, indicating that any traffic is matched.

    NOTE:

    If an IP address group contains an IP address range in the format of Start IP address-End IP address, the IP address group is not supported.

    For example, an IP address group cannot contain 192.168.0.1-192.168.0.62. You need to change 192.168.0.1-192.168.0.62 to 192.168.0.0/26.

    IPv4: 192.168.0.0/16

    Next Hop Type

    Mandatory

    Set the type of the next hop.

    NOTE:

    When you add or modify a custom route in a default route table, the next hop type of the route cannot be set to VPN gateway, Direct Connect gateway, or Cloud connection.

    VPC peering connection

    Next Hop

    Mandatory

    Set the next hop. The resources in the drop-down list box are displayed based on the selected next hop type.

    peer-AB

    Description

    Optional

    Enter the description of the route in the text box as required.

    -

  4. Click OK.

    You can view the new routes in the route list.