edit-icon download-icon

CreateRouteEntry

Last Updated: Apr 09, 2018

Description

Create a route entry for a VRouter or VBR.

Note the following before creating a route entry:

  • Up to 48 route entries can be created for a VPC or VBR.

  • Multiple route entries can point to the same next hop ID (NextHopId).

  • In the route table of a VPC, up to 5 route entries pointing to HAVIP can be created.

  • You can only add a route entry to an active VBR of an enabled leased line.

Request parameters

Name Type Required Description
Action String Yes

The action to perform.

Valid value: CreateRouteEntry

RouteTableId String Yes The ID of the route table.
DestinationCidrBlock String Yes

The destination CIDR block of the route entry, which must meet the following requirements:

  • The destination CIDR block cannot be 100.64.0.0/10 or any of its subnets.

  • Different route entries in a route table cannot use the same destination CIDR block.

  • If the destination CIDR block is an IP address, the netmask /32 is used by default.

NextHopType String No

The type of the next hop. Valid value:

  • Instance (Default): Route the traffic destined for the destination CIDR block to an ECS instance in the VPC.

  • HaVip: Route the traffic destined for the destination CIDR block to an HAVIP.

  • RouterInterface: Route the traffic destined for the destination CIDR block to a router interface.

  • VpnGateway: Route the traffic destined for the destination CIDR block to a VPN Gateway.

NextHopId String No

The ID of the next-hop instance.

The next hop must be in the VPC or VBR to which the router table belongs.

Note: This parameter is required if NextHopList is not specified.

NextHopList JSON string No

A list of next hops of the router entries. Specify this parameter when you create an Equal-cost multi-path routing (ECMP) route entry.

The parameter must meet the following requirements:

  • Only the VRouter of VPC supports adding ECMP route entries.

  • At least two next hops must be specified, but cannot exceed four.

  • The next hops must be the route interfaces pointing to the connected VBRs.

For more information, see NextHopListType.

Note: This parameter is required if NextHopId is not specified.

ClientToken String No

A client token used to ensure the idempotence of requests. This parameter value is generated by the client and must be unique. It cannot exceed 64 ASCII characters.

For more information, see How to ensure idempotence.

Response parameters

Name Type Description
RequestId String The ID of the request.

Error codes

See VPC API Error Center.

Examples

Request example

  1. https://vpc.aliyuncs.com/?Action=CreateRouteEntry
  2. &VpcId=vpc-257gq642n
  3. &RouteTableId=vrt-5citwfp6a
  4. &DestinationCidrBlock=0.0.0.0/0
  5. &NextHopId=i-25skktcp4
  6. &NextHopType=Instance
  7. &<CommonParameters>

Response example

XML format

  1. <CreateRouteEntryResponse>
  2. <RequestId>12D086F6-8F31-4658-84C1-006DED011A85</RequestId>
  3. </CreateRouteEntryResponse>

JSON format

  1. {
  2. "RequestId": "12D086F6-8F31-4658-84C1-006DED011A85"
  3. }
Thank you! We've received your feedback.