edit-icon download-icon

Manage a route table

Last Updated: Oct 10, 2018

Route table basics

A VRouter is a hub in a VPC that connects all VSwitches in the VPC and also serves as a gateway device that connects the VPC with other networks.

A VRouter and a route table are automatically created after you create a VPC. Each entry in the route table is a route entry, which defines the next hop of the network traffic destined for a specific destination CIDR block. The network traffic is routed based on the configurations of the route entries in the route table.

Note: You cannot create or delete a VRouter or a route table directly. They will be deleted automatically along with the deletion of the VPC. But you can add route entries to the route table to route network traffic.

There are two types of route entries:

  • System route entry

    A system route entry is created by the system and cannot be deleted.

    • After you create a VPC, a system route entry will be automatically created.

      The destination CIDR block of this system route entry is 100.64.0.0/10, which is used for the communication within the VPC.

    • After you create a VSwitch, a system route entry will be automatically created.

      The destination CIDR block of this system route entry is the CIDR block of the VSwitch, which controls the routing for the VSwitch.

  • Custom route entry

    You can create or delete custom route entries, and you can create up to 40 custom route entries in a route table.

    Note: In general, system route entries can meet your needs. But in some particular cases, you must add custom route entries. Before adding custom route entries, ensure that you have completed your network plan.

Routing policy

The longest prefix match algorithm is used to route the network traffic when more than one route entries match the destination IP address. That is, the route entry with the longest netmask (the most specific route) is used to determine the next hop.

Here is an example of a route table.

Destination CIDR block Next Hop Type Next Hop Type
100.64.0.0/10 - - System
192.168.0.0/24 - - System
0.0.0.0/0 Instance i-12345678 Custom
10.0.0.0/24 Instance i-87654321 Custom

In this example, route entries with the destination CIDR blocks100.64.0.0/10 and 192.168.0.0/24 are the system route entries. Route entries with the destination CIDR blocks0.0.0.0/0 and 10.0.0.0/24 are custom route entries.

All traffic destined for 0.0.0.0/0 is routed to the ECS instance with the IDi-12345678 and all traffic destined for 10.0.0.0/24 is routed to the ECS instance with the IDi-87654321.

According to the longest prefix match algorithm, the traffic destined for 10.0.0.1 is routed to ECS instance with the IDi-87654321, while the traffic destined for 10.0.1.1 is routed to the ECS instance with the IDi-12345678.

Scenarios of adding custom router entries

The custom route entries are needed in the following scenarios.

  • Traffic routing within a VPC

    Assume that you have two ECS instances in your VPC: ECS01 and ECS02.

    ECS01 is bounded with an Elastic IP (EIP) so that this ECS instance can communicate with the Internet. If you want ECS02 to communicate with the Internet without binding another EIP, you can add a custom route entry as follows.

    Destination CIDRNext hop typeNext hop
    0.0.0.0/0ECS instanceECS01

    VPC domestic routing

  • Interconnection between VPCs

    Assume that you have two VPCs. VPC1 uses the CIDR block 172.16.0.0/12 and VPC2 uses the CIDR block 192.168.0.0/16.

    By using the router interface function of the Express Connect product, you can create a connection between these two VPCs. Firstly, you must create a router interface, and set VPC1 as the initiator and VPC2 as the receiver. Then, you must add two custom route entries as follows.

    VPC interconnection

    • Custom route entry added in VPC1
      Destination CIDRNext hop typeNext hop
      192.168.0.0/16Route interfaceRI1
    • Custom route entry added in VPC2
      Destination CIDRNext hop typeNext hop
      172.16.0.0/12Route interfaceRI2
  • Interconnection between VPC and on-premises IDC

    Assume that you have a VPC with the CIDR block 172.16.0.0/12, and an on-premises IDC with the CIDR block 192.168.0.0/16.

    By using the physical connection (leased line) function of the Express Connect product, you can create a connection between the VPC and the IDC. Firstly, you must create a Virtual Border Router (VBR) to connect the IDC with the VBR. Then, you must create a router interface to connect the VBR with the VPC. Lastly, you must add the following custom router entries:

    Hybrid cloud realization

    • Custom route entry added in VPC
      Destination CIDR blockNext hop typeNext hop
      192.168.0.0/16Route interfaceRI1
    • Custom route entry added in VBR
      Destination CIDRNext hop typeNext hop
      192.168.0.0/16Leased lineRI3
      172.16.0.0/12VPCRI2
    • Custom route entry added in IDC
      Destination CIDRNext hop typeNext hop
      172.16.0.0/12RI4

Add custom route entries

  1. Log on to the VPC console.

  2. In the left-side navigation pane, click VPC.

  3. Choose the region where the VPC is created.

  4. Click the ID of the target VPC.

  5. In the left-side VPC Details pane, click VRouter, and then click Add Route Entry.

  6. In the Add Route Entry dialog, provide the following information and click OK.

    ConfigurationDescription
    Destination CIDR Block

    Enter the destination CIDR block.

    If you enter an IP address, the network mask /32 is used by default.

    Next hop type

    Choose a type of the next hop.

    • ECS instance: routes the traffic destined for the destination CIDR to an ECS instance.
    • Router interface: routes the traffic destined for the destination CIDR to a router interface. Then the router interface will route the traffic to its peer router interface.
    • VPN gateway: routes the traffic destined for the destination CIDR to the specified VPN gateway.
    Next hop

    The next hop that receives the routed traffic.

    Note: If you select ECMP-Routing, you must add at least two router interfaces, and the corresponding peer router interface must be a Virtual Boarder Interface (VBR).

Thank you! We've received your feedback.