Adds a custom route entry to the route table of a vRouter or a virtual border router (VBR).
Usage notes
- CreateRouteEntry is an asynchronous operation. After you send a request, the system returns a request ID and runs the task in the background. You can call the DescribeRouteEntryList operation to query the status of a route entry.
- If the route entry is in the Creating state, the route entry is being created.
- If the route entry is in the Created state, the route entry is created.
- You cannot repeatedly call the CreateRouteEntry operation to add a custom route entry to the route table of a vRouter or a VBR within the specified period of time.
- A route table can contain up to 200 custom route entries.
- The destination CIDR block (DestinationCidrBlock) of a custom route entry cannot be the same as or overlap with the CIDR block of a vSwitch in the virtual private cloud (VPC).
- The destination CIDR block (DestinationCidrBlock) of a custom route entry cannot be 100.64.0.0/10 or a subset of it.
- The destination CIDR blocks (DestinationCidrBlock) of route entries in the same route table must be unique.
- If you do not include the mask length when you specify the destination CIDR block (DestinationCidrBlock), the destination CIDR block is considered a host IP address whose mask length is 32 bits.
- Multiple custom route entries can point to the same next hop (NextHopId).
- The next hop (NextHopId) of a custom route entry must belong to the same VPC as the route table.
- Equal-cost multi-path (ECMP) routing can be configured by specifying the NextHopList parameter.
- When you add non-ECMP route entries, you must specify DestinationCidrBlock, NextHopType, and NextHopId, and you must not specify NextHopList.
- When you add route entries for ECMP routing, you must specify DestinationCidrBlock and NextHopList, and you must not specify NextHopType or NextHopId.
- A route table can contain up to 200 custom route entries.
- The NextHopList parameter is not supported.
- The destination CIDR block (DestinationCidrBlock) of a custom route entry cannot be 100.64.0.0/10 or a subset of it.
- The destination CIDR blocks (DestinationCidrBlock) of route entries in the same route table must be unique.
- If you do not include the mask length when you specify the destination CIDR block (DestinationCidrBlock), the destination CIDR block is considered a host IP address whose mask length is 32 bits.
- Multiple custom route entries can point to the same next hop (NextHopId).
- The next hop (NextHopId) of a custom route entry must be a router interface associated with the VBR.
- You can add route entries only when the VBR is in the Active state, and the Express Connect circuit associated with the VBR is in the Enabled state and is not locked due to overdue payments.
- Only non-ECMP route entries are supported. When you add non-ECMP route entries, you must specify DestinationCidrBlock, NextHopType, and NextHopId, and you cannot specify NextHopList.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | CreateRouteEntry | The operation that you want to perform. Set the value to CreateRouteEntry. |
RegionId | String | No | cn-hangzhou | The region ID of the route table. You can call the DescribeRegions operation to query the most recent region list. |
RouteTableId | String | Yes | vtb-bp145q7glnuzd**** | The ID of the route table to which you want to add a custom route entry. |
DestinationCidrBlock | String | Yes | 192.168.0.0/24 | The destination CIDR block of the custom route entry. Both IPv4 and IPv6 CIDR blocks are supported. Make sure that the destination CIDR block meets the following requirements:
|
NextHopId | String | No | i-j6c2fp57q8rr4jlu**** | The ID of the next hop. |
ClientToken | String | No | 02fb3da4-130e-11e9-8e44-001**** | The client token that is used to ensure the idempotence of the request. You can use the client to generate the value, but you must make sure that the value is unique among different requests. The ClientToken value can contain only ASCII characters. Note If you do not specify this parameter, ClientToken is set to the value of RequestId. The value of RequestId for each API request may be different. |
RouteEntryName | String | No | test | The name of the custom route entry that you want to add. The name must be 1 to 128 characters in length, and cannot start with |
Description | String | No | test | The description of the custom route entry. The description must be 1 to 256 characters in length, and cannot start with |
NextHopType | String | No | RouterInterface | The type of next hop of the custom route entry. Valid values:
|
NextHopList.N.NextHopId | String | No | ri-2zeo3xzyf3cd8r4**** | The ID of the next hop of the ECMP route. |
NextHopList.N.Weight | Integer | No | 10 | The weight of the next hop of the ECMP route entry. |
NextHopList.N.NextHopType | String | No | RouterInterface | The type of next hop of the ECMP route entry. Set the value to RouterInterface. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RouteEntryId | String | rte-sn6vjkioxte1gz83z**** | The ID of the custom route entry. |
RequestId | String | 0ED8D006-F706-4D23-88ED-E11ED28DCAC0 | The ID of the request. |
Examples
Sample requests
http(s)://[Endpoint]/?Action=CreateRouteEntry
&RegionId=cn-hangzhou
&RouteTableId=vtb-bp145q7glnuzd****
&DestinationCidrBlock=192.168.0.0/24
&NextHopId=i-j6c2fp57q8rr4jlu****
&ClientToken=02fb3da4-130e-11e9-8e44-001****
&RouteEntryName=test
&Description=test
&NextHopType=RouterInterface
&NextHopList=[{"NextHopId":"ri-2zeo3xzyf3cd8r4****","Weight":10,"NextHopType":"RouterInterface"}]
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<CreateRouteEntryResponse>
<RouteEntryId>rte-sn6vjkioxte1gz83z****</RouteEntryId>
<RequestId>0ED8D006-F706-4D23-88ED-E11ED28DCAC0</RequestId>
</CreateRouteEntryResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"RouteEntryId" : "rte-sn6vjkioxte1gz83z****",
"RequestId" : "0ED8D006-F706-4D23-88ED-E11ED28DCAC0"
}
Error codes
HttpCode | Error code | Error message | Description |
---|---|---|---|
400 | IllegalParam.CidrBlock | The specified CidrBlock is illegal. | The error message returned because CidrBlock is set to an invalid value. |
400 | QuotaExceeded | Route entry quota exceeded in this route table. | The error message returned because the number of route entries in the route table has reached the upper limit. |
400 | MissingParameter | Miss mandatory parameter. | The error message returned because one or more required parameters are not set. Check whether you have set all required parameters before you call this operation. |
400 | InvalidCidrBlock.Malformed | Specified CIDR block is not valid. | The error message returned because the format of the specified CIDR block is invalid. |
400 | InvalidCIDRBlock.Duplicate | Specified CIDR block is already exists. | The error message returned because the specified CIDR block already exists in the route table. |
400 | IncorrectVpcStatus | Current VPC status does not support this operation. | The error message returned because this operation cannot be performed when the VPC is in the current state. |
400 | IncorrectInstanceStatus | Current instance status does not support this operation. | The error message returned because this operation cannot be performed while the instance is in the current state. |
400 | IncorrectRouteEntryStatus | Some route entry status blocked this operation. | The error message returned because one or more route entries in the current route table are in the Pending or Modifying state. |
400 | InvalidCidrBlock | Specified CIDR block is not valid. | The error message returned for one of the following reasons: 1. You are unauthorized to use the 10.0.0.0/8 CIDR block. Check whether your account is included in the whitelist to use the CIDR block. 2. The destination CIDR block of the added custom route entry cannot be a subset of the CIDR blocks of the vSwitches in the VPC. 3. The CIDR block cannot be 100.64.0.0/10. |
400 | InvalidNextHopType | Specified parameter "NextHopType" is not valid | The error message returned because the specified next hop type is invalid. |
400 | InvalidNextHop.NotFound | Specified next hop does not exist. | The error message returned because the specified next hop does not exist. |
400 | InvalidVRouter.NotFound | vRouter not exists. | The error message returned because the specified vRouter does not exist. Check whether the specified vRouter is valid. |
400 | InvalidVPC.NotFound | vpc not exists. | The error message returned because the specified VPC does not exist. Check whether the specified VPC is valid. |
400 | InvalidNexthopTypeAndList.BothNull | both nexthopType and nextHopList are null. | The error message returned because the NextHopType and NextHopList parameters are not specified. |
400 | InvalidNexthopTypeAndList.BothNotNull | both nexthopType and nextHopList are not null. | The error message returned because you cannot leave both the NextHopType and the NextHopList parameters empty. |
400 | InvalidRouterInterface | invalid router interface. | The error message returned because the specified router interface does not exist. |
400 | InvalidOppositeRouterType | nexthop list cannot only contain router interface whose opposite router interface is on vbr. | The error message returned because the specified next hop is invalid. The peer router of the router interface that you specify as the next hop must be a VBR. |
400 | InvalidNexthopListSize | nexthop size is illegal. Must be between 2 and 4. | The error message returned because you must specify two to four router interfaces as next hops. |
400 | InvalidEntryRuleQuota.NotFound | Route entry quota rule not exists. | The error message returned because the quota rules of route entries do not exist. |
400 | Forbidden.CheckEntryRuleQuota | Route entry quota rule check error. | The error message returned because an error occurred when the system was checking the quota of route entries. |
400 | InvalidVBRStatus | invalid virtual border router status. | The error message returned because the VBR is in an invalid state. |
400 | InvalidPhysicalConnectionBusinessStatus | invalid physical connection business status. | The error message returned because the Express Connect circuit is in an invalid state. |
400 | IncorrectHaVipStatus | This operation is denied because satus of the specified HaVip is neither Available nor InUse. | The error message returned because you cannot perform the operation when the specified HAVIP is in the Available or InUse state. |
400 | CountLimitExceed.HaVipRouteEntry | There can be 5 route entry to HaVip at most in one route table. | The error message returned because the number of route entries that point to the HAVIP has reached the upper limit. |
400 | InvalidRouteEntry.Duplicate | The route entry already exist. | The error message returned because the specified route entry already exists. |
400 | IncorrectRouteEntryStatus | Specified routeEntry status error. | The error message returned because one or more route entries in the current route table are in the Pending or Modifying state. |
400 | IncorrectRouteEntryStatus | VBR has NotStable route entry. | The error message returned because one or more route entries in the current VBR are in the Pending or Modifying state. |
400 | InvalidParam | The Ecmp routerEntry with router interfaces local vgw vip not match. | The error message returned because the route entry does not match the gateway IP address of the router interface. |
400 | INVALID_WEIGHT_PARAM | Specified value of weight invalid | The error message returned because the specified weight is invalid. |
400 | FORBIDDEN_USE_VPC_AS_INTERNET_GATEWAY | The Specified CIDR must be in vpc CIDR. | The error message returned because the specified CIDR block must be a subset of the VPC CIDR block. |
400 | INVALID_VPC_ID | The Specified VpcId not match. | The error message returned because the specified VPC does not exist. Check whether the specified VPC ID is valid. |
400 | InvalidRouteEntrySize | The Specified routerEntry size not legal. | The error message returned because you must specify two to four router interfaces as next hops if you want to configure ECMP routing. |
400 | TaskConflict | The operation is too frequent, please wait a moment and try again. | The error message returned because your requests are too frequent. Try again later. |
400 | InvalidRouteEntry | Specified routeEntry not exist. | The error message returned because the specified route entry does not exist. |
400 | RouteConflict.AlreadyExist | Route conflict exists in routing table. | The error message returned because route conflicts exist in the route table. |
400 | InvalidRouteEntryName.Malformed | Specified RouteEntry name is not valid. | The error message returned because the name of the route entry is invalid. |
400 | InvalidNexthop.DirectEni | The direct Eni cannot be nexthop. | The error message returned because an ENI in cut-through mode cannot be specified as a next hop. |
400 | QuotaExceeded.VpnRouteEntry | Vpn route entry quota exceeded. | The error message returned because the system failed to create the route entry. Check whether the number of route entries in the VPN gateway route table reaches the upper limit. |
400 | InvalidAttachment.NotFound | The attachment is not found. | The error message returned because the specified transit router does not exist. |
400 | OperationFailed.ActiveNetworkInterfaceNotFound | No active network interface is found on the attachment. | The error message returned because no ENI is available on the specified transit router. |
400 | InvalidNetworkInterface.NotFound | The network interface is not found on the attachment. | The error message returned because no ENI is associated with the specified transit router. |
400 | OperationFailed.QueryAttachmentInfo | Failed to query attachment information. | The error message returned because the system fails to query the transit router. |
400 | IllegalParam.AttachmentId | The attachment is invalid. | The error message returned because the specified transit router is invalid. |
400 | OperationFailed.NotSupportIPV6 | The specified next hop does not support IPv6. | The error message returned because the specified next hop does not support IPv6. |
400 | IncorrectStatus.Ipv6Address | The IPv6 address of the specified next hop is being assigned or deleted. | The error message returned because an IPv6 address is being assigned to or removed from the next hop. |
400 | OperationUnsupported.Ipv6EntryOnPrimaryNetworkInterface | You cannot create IPv6 route entries on a primary network interface. | The error message returned because you cannot create an IPv6 route entry whose next hop is a primary ENI. |
400 | OperationUnsupported.SpecifyIpOnIpv6Entry | You cannot specify the private IP address when you create IPv6 route entries. | The error message returned because you cannot specify a private IPv6 address as the destination CIDR block. |
400 | OperationUnsupported.MutipleIpv6Address | You cannot specify a next hop that has bound multiple IPv6 addresses. | The error message returned because you cannot specify a next hop that is assigned multiple IPv6 addresses. |
400 | OperationDenied.Ipv6EntryOnCustomTable | You cannot create any IPv6 route entry on a custom route table. | The error message returned because you cannot add an IPv6 route entry to a custom route table. |
400 | OperationDenied.CloudBoxVbrEntryAllowedInCustomRouteTable | The operation is not allowed because only the custom routing table can add a routing entry with the next hop pointing to the cloud box type VBR. | The error message returned because you can add a route entry to a custom route table only if the next hop of the route entry points to a VBR connected to a cloud box. |
400 | OperationDenied.RouteTableAssociateNotCloudBoxVSwitch | The operation is not allowed because of the routing table is bound to a non-cloud box type vswitch, and routing entries pointing to the cloud box VBR cannot be added. | The error message returned because the vSwitch with which the route table is associated is not connected to a CloudBox instance. Therefore, you cannot add a route entry that points to a VBR connected to a CloudBox instance. |
400 | OperationDenied.VbrMisMatchCloudBox | The operation is not allowed because the routing table is bound to a cloud box vswitch, and routing entries pointing to other cloud box VBRs cannot be added. | The error message returned because the VBR and the vSwitch that is associated with the route table are connected to different CloudBox instances. |
400 | OperationDenied.VbrIdle | The operation is not allowed because the next hop of the added routing entry is a VBR type RI at the opposite end, which cannot be in an idle state. | The error message returned because the router interface that you specify as the next hop is in the Idle state. If the peer router of the next hop router interface is a VBR, the next hop router interface must not be in the Idle state. |
400 | OperationDenied.RouterInterfaceToDifferentVpc | The operation is not allowed because the router interface is connected to different VPCs. | The error message returned because the router interfaces that you specify as next hops when you configure ECMP routing do not belong to the same VPC. |
400 | OperationDenied.RouterInterfaceFromDifferentZones | The operation is not allowed because the router interface resides in different zones. | The error message returned because the route interface belongs to a different zone. |
400 | OperationFailed.PconnTrafficNotEnable | The operation is failed because of PconnTrafficNotEnable. | The error message returned because outbound data transfer billing is disabled. |
400 | ResourceNotFound.VpcPeer | The specified resource of %s is not found. | The error message returned because the peer VPC cannot be found. |
400 | OperationDenied.RouteTableTypeNotPermitted | The operation is not allowed because the type of route table is not permitted. | The error message returned because you cannot add route entries to route tables of the specified type. |
400 | OperationDenied.GatewayRouteTableNotPermitted | The operation is not allowed to create a route pointing to this nextHop type on gateway route table. | The error message returned because the gateway route table does not support route entries that point to the specified instance type. |
403 | IncorrectInstanceStatus | The current status of the resource does not support this operation. | The error message returned because the specified resource is in a state that does not support the operation. |
404 | InvalidInstanId.NotFound | Specified instance does not exist. | The error message returned because the specified instance does not exist. Check whether the instance ID is valid. |
404 | InvalidNextHopId.NotFound | Specified next hop does not exist. | The error message returned because the specified next hop does not exist. |
404 | InvalidRouteTableId.NotFound | Specified route table does not exist. | The error message returned because the specified route table does not exist. |
404 | InvalidHaVipId.NotFound | The specified HaVip does not exist in the specified VPC. | The error message returned because the specified HAVIP does not exist in the VPC. |
500 | InternalError | The request processing has failed due to some unknown error, exception or failure. | The error message returned because an internal error has occurred. |
500 | IncorrectStatus.Ipv4Gateway | The status of Ipv4Gateway is incorrect. | The error message returned because the IPv4 gateway is unstable. |
For a list of error codes, see Service error codes.