You can call this operation to create a custom route entry in a route table of a VRouter or Virtual Border Router (VBR).
Description
When you call this operation to create a custom route entry in a route table of a VRouter, follow these rules:- The number of custom route entries in a route table cannot exceed 48.
- The destination CIDR block of a custom route entry and the CIDR block of a VSwitch in a VPC network cannot be the same or be a subset of each other.
- The destination CIDR block of a custom route entry cannot be 100.64.0.0/10 or a subset of 100.64.0.0/10.
- The destination CIDR blocks of route entries in the same route table cannot be the same.
- If the specified destination CIDR block is an IP address, the 32-bit subnet mask is used.
- Multiple custom route entries can point to the same next hop.
- The next hop of a custom route entry must belong to the same VPC network as the route table.
- You can configure equal-cost multi-path (ECMP) route entries by setting the NextHopList
parameter.
- When you add non-ECMP route entries, you must set DestinationCidrBlock, NextHopType, and NextHopId. NextHopList parameter is not supported.
- When you add ECMP route entries, you must set DestinationCidrBlock and NextHopList. NextHopType and NextHopId parameter are not supported.
- The number of custom route entries in a route table cannot exceed 48.
- The NextHopList parameter is not supported.
- The destination CIDR block of a custom route entry cannot be 100.64.0.0/10 or a subset of 100.64.0.0/10.
- The destination CIDR block of route entries in the same route table cannot be the same.
- If the specified destination CIDR block is an IP address, the 32-bit subnet mask is used.
- Multiple route entries can point to the same next hop.
- The next hop of a custom route entry must be a VRouter interface associated with the VBR.
- You can add route entries only when the VBR is in the Active state, and the physical connection associated with the VBR is enabled and unlocked.
- You can add only non-ECMP route entries. To create such an entry, you must set DestinationCidrBlock, NextHopType, and NextHopId. NextHopList parameter is not supported.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | CreateRouteEntry |
The operation that you want to perform. Set the value to CreateRouteEntry. |
DestinationCidrBlock | String | Yes | 192.168.0.1/24 |
The destination CIDR block of the custom route entry. IPv4 and IPv6 CIDR blocks are supported. When you specify a destination CIDR block, follow these rules:
|
RouteTableId | String | Yes | vtb-bp145q7glnuzd**** |
The ID of the route table in which you want to create custom route entries. |
RegionId | String | Yes | cn-hangzhou |
The ID of the region to which the route table belongs. You can call the DescribeRegions operation to query the ID of the region to which the route table belongs. |
NextHopId | String | No | ri-2zeo3xzyf38r4**** |
The ID of the next-hop instance of the custom route entry. |
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 that is unique among different requests. The ClientToken value can only contain ASCII characters and cannot exceed 64 characters in length. For more information, see How to ensure idempotence. |
RouteEntryName | String | No | test |
The name of the custom route entry that you want to create. The name must be 2 to 128 characters in length and can contain letters, Chinese characters, digits, underscores (_), and hyphens (-). The name must start with a letter or Chinese character. |
NextHopType | String | No | RouterInterface |
The type of the next hop of the custom route entry. Valid values:
|
NextHopList.N.NextHopType | String | No | RouterInterface |
The next-hop type of the ECMP route. Valid value: RouterInterface |
NextHopList.N.NextHopId | String | No | ri-2zeo3xzyf3cd8r4**** |
The ID of the next-hop instance of the ECMP route entry. |
NextHopList.N.Weight | Integer | No | 10 |
The route weight of the next hop of the ECMP route. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RequestId | String | 0ED8D006-F706-4D23-88ED-E11ED28DCAC0 |
The ID of the request. |
Examples
Sample requests
https://vpc.aliyuncs.com/?Action=CreateRouteEntry
&DestinationCidrBlock=192.168.0.1/24
&RouteTableId=vtb-bp145q7glnuzd****
&<Common request parameters>
Sample success responses
XML
format
<CreateRouteEntryResponse>
<RequestId>12D086F6-8F31-4658-84C1-006DED011A85</RequestId>
</CreateRouteEntryResponse>
JSON
format
{
"RequestId": "12D086F6-8F31-4658-84C1-006DED011A85"
}
Error codes
Http status code | Error code | Error message | Description |
---|---|---|---|
404 | InvalidInstanId.NotFound | Specified instance does not exist. | The error message returned because the specified instance does not exist. You can check whether the instance ID is correct. |
400 | MissingParameter | Miss mandatory parameter. | The error message returned because the required parameters are missing. 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 specified CIDR block format is invalid. |
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. |
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 the VPC network in the current state does not support this operation. |
400 | IncorrectInstanceStatus | Current instance status does not support this operation. | The error message returned because the instance in the current state does not support this operation. |
400 | QuotaExceeded | Route entry quota exceeded in this route table. | The error message returned because the number of route entries in the route table exceeds the upper limit. |
400 | IncorrectRouteEntryStatus | Some route entry status blocked this operation. | The error message returned because you cannot perform this operation. 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 because: 1. The specified CIDR block is not in the whitelist for the 10.0.0.0/8 CIDR block. 2. The destination CIDR block of the added route entry cannot belong to any of the CIDR blocks of VSwitches in the same VPC network. 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 IP address of the specified next hop does not exist. |
400 | InvalidVRouter.NotFound | vRouter not exists. | The error message returned because the specified router does not exist. You can check whether the configuration of the specified router is valid. |
400 | InvalidVPC.NotFound | vpc not exists. | The error message returned because the specified VPC network does not exist. You can check whether the configuration of the VPC network is valid. |
400 | InvalidNexthopTypeAndList.BothNull | both nexthopType and nextHopList are null. | The error message returned because the next hop type and next hop list are null. |
400 | InvalidNexthopTypeAndList.BothNotNull | both nexthopType and nextHopList are not null. | The error message returned because the next hop type and next hop list cannot be null at the same time. |
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 type of the peer router of the router interface used 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 the number of router interfaces used as the next hops is invalid. You must specify 2 to 4 router interfaces as the next hops. |
400 | InvalidEntryRuleQuota.NotFound | Route entry quota rule not exists. | The error message returned because the route entry quota rule does not exist. |
400 | Forbidden.CheckEntryRuleQuota | Route entry quota rule check error. | The error message returned because an error occurred while the system checking the quota of route entries. |
400 | InvalidVBRStatus | invalid virtual border router status. | The error message returned because the status of the VBR is invalid. |
400 | InvalidPhysicalConnectionBusinessStatus | invalid physical connection business status. | The error message returned because the status of the specified physical connection is invalid. |
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 network. |
400 | IncorrectHaVipStatus | This operation is denied because satus of the specified HaVip is neither Available nor InUse. | The error message returned because this operation cannot be performed because the HaVip is not 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 pointing to the HaVip instance has reached the upper limit. |
400 | InvalidRouteEntry.Duplicate | The route entry already exist. | The error message returned because the specified route entry already exists. |
403 | IncorrectInstanceStatus | The current status of the resource does not support this operation. | The error message returned because the current instance status does not support this operation. |
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 network does not exist. You can check whether the configuration of the VPC network is valid. |
400 | InvalidRouteEntrySize | The Specified routerEntry size not legal. | The error message returned because the number of router interfaces used as the next hops is invalid. you must configure 2 to 4 router interfaces as the next hops to configure ECMP route entries. |
400 | InvalidRouteEntry | Specified routeEntry not exist. | The error message returned because the specified route entry does not exist. |
For a list of error codes, visit the API Error Center.