调用CreateRouteEntry接口在VPC路由器或边界路由器的路由表中添加自定义路由条目。
使用说明
- CreateRouteEntry接口属于异步接口,即系统会返回一个实例ID,但该路由的创建尚未完成,系统后台的启动任务仍在进行。您可以调用DescribeRouteEntryList查询路由的创建状态:
- 当路由处于Creating状态时,表示路由创建中。
- 当路由处于Created状态时,表示路由创建完成。
- CreateRouteEntry接口不支持在同一个VPC或者同一个VBR中并发创建自定义路由条目。
- 同一个路由表中自定义路由条目不能超过200条。
- 自定义路由条目的目标网段(DestinationCidrBlock)不能和VPC内的交换机的网段相同,也不能包含交换机的网段或者被交换机的网段包含。
- 自定义路由条目的目标网段(DestinationCidrBlock)不能指向100.64.0.0/10,也不能被100.64.0.0/10包含。
- 同一路由表下的路由条目的目标网段(DestinationCidrBlock)不允许相同。
- 如果指定的目标网段(DestinationCidrBlock)是一个IP地址,会按照32位掩码来处理。
- 多条自定义路由条目可以指向同一个下一跳(NextHopId)。
- 自定义路由条目的下一跳(NextHopId)必须和路由表在同一个VPC。
- 支持通过NextHopList参数配置ECMP路由:
- 添加普通(非ECMP)自定义路由时,需指定DestinationCidrBlock、NextHopType和NextHopId参数,且不能指定NextHopList参数。
- 添加ECMP路由时,需指定DestinationCidrBlock和NextHopList参数,且不能指定NextHopType和NextHopId参数。
- 同一个路由表中自定义路由条目不能超过200条。
- 不支持NextHopList参数。
- 自定义路由条目的目标网段(DestinationCidrBlock)不能指向100.64.0.0/10,也不能被100.64.0.0/10包含。
- 同一路由表下的路由条目的目标网段(DestinationCidrBlock)不允许相同。
- 如果指定的目标网段(DestinationCidrBlock)是一个IP地址,会按照32位掩码来处理。
- 多条自定义路由条目可以指向同一个下一跳(NextHopId)。
- 自定义路由条目的下一跳(NextHopId)必须是该VBR关联的路由器接口。
- 只允许在VBR状态是Active,而且对应的物理专线状态是Enabled且没有被欠费锁定的情况下在VBR上新建路由条目。
- 仅支持添加普通路由(非ECMP),需指定DestinationCidrBlock、NextHopType和NextHopId参数,且不能指定NextHopList参数。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
请求参数
名称 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
Action | String | 是 | CreateRouteEntry | 系统规定参数。取值:CreateRouteEntry。 |
RegionId | String | 否 | cn-hangzhou | 路由表所属地域的ID。 您可以通过调用DescribeRegions接口获取地域ID。 |
RouteTableId | String | 是 | vtb-bp145q7glnuzd**** | 要添加自定义路由条目的路由表ID。 |
DestinationCidrBlock | String | 是 | 192.168.0.0/24 | 自定义路由条目的目标网段,支持IPv4和IPv6的目标网段。需满足以下要求:
|
NextHopId | String | 否 | i-j6c2fp57q8rr4jlu**** | 自定义路由条目的下一跳实例的ID。 |
ClientToken | String | 否 | 02fb3da4-130e-11e9-8e44-001**** | 客户端Token,用于保证请求的幂等性。 从您的客户端生成一个参数值,请确保不同请求间该参数值唯一。ClientToken只支持ASCII字符。 说明 若您未指定,则系统自动使用API请求的RequestId作为ClientToken标识。每次API请求的RequestId不一样。 |
RouteEntryName | String | 否 | test | 要添加的自定义路由条目的名称。 名称长度为1~128个字符,不能以 |
Description | String | 否 | test | 自定义路由条目的描述信息。 描述长度为1~256个字符,不能以 |
NextHopType | String | 否 | RouterInterface | 自定义路由条目的下一跳的类型,取值:
|
NextHopList.N.NextHopId | String | 否 | ri-2zeo3xzyf3cd8r4**** | ECMP路由的下一跳实例的ID。 |
NextHopList.N.Weight | Integer | 否 | 10 | ECMP路由的下一跳的路由权重。 |
NextHopList.N.NextHopType | String | 否 | RouterInterface | ECMP路由的下一跳的类型,目前仅取值:RouterInterface(路由器接口)。 |
返回数据
名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
RouteEntryId | String | rte-sn6vjkioxte1gz83z**** | 自定义路由条目的ID。 |
RequestId | String | 0ED8D006-F706-4D23-88ED-E11ED28DCAC0 | 请求ID。 |
示例
请求示例
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"}]
&公共请求参数
正常返回示例
XML
格式
HTTP/1.1 200 OK
Content-Type:application/xml
<CreateRouteEntryResponse>
<RouteEntryId>rte-sn6vjkioxte1gz83z****</RouteEntryId>
<RequestId>0ED8D006-F706-4D23-88ED-E11ED28DCAC0</RequestId>
</CreateRouteEntryResponse>
JSON
格式
HTTP/1.1 200 OK
Content-Type:application/json
{
"RouteEntryId" : "rte-sn6vjkioxte1gz83z****",
"RequestId" : "0ED8D006-F706-4D23-88ED-E11ED28DCAC0"
}
错误码
HttpCode | 错误码 | 错误信息 | 描述 |
---|---|---|---|
400 | IllegalParam.CidrBlock | The specified CidrBlock is illegal. | CidrBlock参数非法。 |
400 | QuotaExceeded | Route entry quota exceeded in this route table. | 超过路由条目配额。 |
400 | MissingParameter | Miss mandatory parameter. | 缺少必要参数,请您检查必填参数是否都已填后再进行操作。 |
400 | InvalidCidrBlock.Malformed | Specified CIDR block is not valid. | 该CIDR格式不正确。 |
400 | InvalidCIDRBlock.Duplicate | Specified CIDR block is already exists. | 该网段已经在该路由表中存在。 |
400 | IncorrectVpcStatus | Current VPC status does not support this operation. | 当前VPC的状态无法支持这个操作。 |
400 | IncorrectInstanceStatus | Current instance status does not support this operation. | 当前实例的状态不支持该操作。 |
400 | IncorrectRouteEntryStatus | Some route entry status blocked this operation. | 无法执行该操作,当前路由表中有路由条目的状态为pending或modifying。 |
400 | IncorrectVSwitchStatus | The current virtual switch status does not support this operation. | 该vSwitch处于pending状态,无法删除。 |
400 | InvalidCidrBlock | Specified CIDR block is not valid. | 可能的报错原因:1.您不在10.0.0.0/8的路由网段的白名单中,不能使用该网段。2.添加的自定义路由目标网段不能从属于同一个VPC下面所有交换机的网段。3.网段不能是100.64.0.0/10。 |
400 | InvalidNextHopType | Specified parameter "NextHopType" is not valid | 该下一跳类型不合法。 |
400 | InvalidNextHop.NotFound | Specified next hop does not exist. | 该下一跳地址不存在。 |
400 | InvalidVRouter.NotFound | vRouter not exists. | 路由器不存在,请您检查输入的路由器是否正确。 |
400 | InvalidVPC.NotFound | vpc not exists. | 专有网络不存在,请您检查输入的专有网络是否正确。 |
400 | InvalidNexthopTypeAndList.BothNull | both nexthopType and nextHopList are null. | 下一跳类型和下一跳列表都为空。 |
400 | InvalidNexthopTypeAndList.BothNotNull | both nexthopType and nextHopList are not null. | 下一跳类型和下一跳列表不能同时为空。 |
400 | InvalidRouterInterface | invalid router interface. | 该路由器接口不存在。 |
400 | InvalidOppositeRouterType | nexthop list cannot only contain router interface whose opposite router interface is on vbr. | 下一跳的路由器接口的对端路由器类型必须为边界路由器。 |
400 | InvalidNexthopListSize | nexthop size is illegal. Must be between 2 and 4. | 必须指定2~4个路由器接口作为下一跳。 |
400 | InvalidEntryRuleQuota.NotFound | Route entry quota rule not exists. | 路由条目配额规则不存在。 |
400 | Forbidden.CheckEntryRuleQuota | Route entry quota rule check error. | 检查路由条目配额时发生了错误。 |
400 | InvalidVBRStatus | invalid virtual border router status. | 边界路由器状态不合法。 |
400 | InvalidPhysicalConnectionBusinessStatus | invalid physical connection business status. | 物理专线状态不合法。 |
400 | IncorrectHaVipStatus | This operation is denied because satus of the specified HaVip is neither Available nor InUse. | 无法执行该操作,因为HaVip的状态是Available或InUse。 |
400 | CountLimitExceed.HaVipRouteEntry | There can be 5 route entry to HaVip at most in one route table. | 指向该HaVip实例的路由条目数量已达上限。 |
400 | InvalidRouteEntry.Duplicate | The route entry already exist. | 指定的路由条目已存在。 |
400 | IncorrectRouteEntryStatus | Specified routeEntry status error. | 无法执行该操作,当前路由表中有路由条目的状态为pending或modifying。 |
400 | IncorrectRouteEntryStatus | VBR has NotStable route entry. | 无法执行该操作,边界路由表中有路由条目的状态为pending或modifying。 |
400 | InvalidParam | The Ecmp routerEntry with router interfaces local vgw vip not match. | 路由条目与路由器接口本地视频网关VIP不匹配。 |
400 | INVALID_WEIGHT_PARAM | Specified value of weight invalid | 该权重不合法。 |
400 | FORBIDDEN_USE_VPC_AS_INTERNET_GATEWAY | The Specified CIDR must be in vpc CIDR. | 该网段必须是VPC网段的子集。 |
400 | INVALID_VPC_ID | The Specified VpcId not match. | 该VPC不存在,请您检查输入的VPC是否正确。 |
400 | InvalidRouteEntrySize | The Specified routerEntry size not legal. | 等价路由需要选择2~4个路由器接口作为路由下一跳。 |
400 | TaskConflict | The operation is too frequent, please wait a moment and try again. | 操作过于频繁,请稍等一会再重试 |
400 | InvalidRouteEntry | Specified routeEntry not exist. | 该路由条目不存在。 |
400 | RouteConflict.AlreadyExist | Route conflict exists in routing table. | 路由表中存在路由冲突。 |
400 | InvalidRouteEntryName.Malformed | Specified RouteEntry name is not valid. | 无法修改,因为指定的路由条目名称无效 |
400 | InvalidNexthop.DirectEni | The direct Eni cannot be nexthop. | 直通Eni不能作为下一跳 |
400 | QuotaExceeded.VpnRouteEntry | Vpn route entry quota exceeded. | 创建路由条目失败,因为vpn路由条目超出限制 |
400 | InvalidAttachment.NotFound | The attachment is not found. | Attachment不存在。 |
400 | OperationFailed.ActiveNetworkInterfaceNotFound | No active network interface is found on the attachment. | Attachment上不存在可用的弹性网卡。 |
400 | InvalidNetworkInterface.NotFound | The network interface is not found on the attachment. | Attachment上的弹性网卡不存在。 |
400 | OperationFailed.QueryAttachmentInfo | Failed to query attachment information. | 查询Attachment信息失败。 |
400 | IllegalParam.AttachmentId | The attachment is invalid. | Attachment非法。 |
400 | OperationFailed.NotSupportIPV6 | The specified next hop does not support IPv6. | 指定的下一跳不支持IPv6功能。 |
400 | IncorrectStatus.Ipv6Address | The IPv6 address of the specified next hop is being assigned or deleted. | 指定的下一跳的IPv6地址此时正在被创建或删除中。 |
400 | OperationUnsupported.Ipv6EntryOnPrimaryNetworkInterface | You cannot create IPv6 route entries on a primary network interface. | 不允许创建下一跳为主网卡的IPv6路由。 |
400 | OperationUnsupported.SpecifyIpOnIpv6Entry | You cannot specify the private IP address when you create IPv6 route entries. | 创建IPv6路由不允许指定private IP参数。 |
400 | OperationUnsupported.MutipleIpv6Address | You cannot specify a next hop that has bound multiple IPv6 addresses. | 不允许指定绑定了多个IPV6地址的下一跳。 |
400 | OperationDenied.Ipv6EntryOnCustomTable | You cannot create any IPv6 route entry on a custom route table. | 不允许在自定义路由表上创建IPv6路由。 |
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. | 指定操作被禁止,因为只有自定义路由表能够添加下一跳指向云盒类型VBR的路由条目。 |
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. | 指定操作被禁止,因为路由表绑定到了非云盒类型的vSwitch上,不能添加指向云盒VBR的路由条目。 |
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. | 指定操作被禁止,因为路由表绑定到了一个云盒vSwitch上,不能添加指向其他云盒VBR的路由条目。 |
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. | 指定操作被禁止,因为添加的路由条目下一跳是对端为VBR类型的RI,不能处于空闲状态。 |
400 | OperationDenied.RouterInterfaceToDifferentVpc | The operation is not allowed because the router interface is connected to different VPCs. | 指定操作被禁止,因为路由器接口指向不同的VPC。 |
400 | OperationDenied.RouterInterfaceFromDifferentZones | The operation is not allowed because the router interface resides in different zones. | 指定操作被禁止,因为路由器接口来自不同的可用区。 |
400 | OperationFailed.PconnTrafficNotEnable | The operation is failed because of PconnTrafficNotEnable. | 操作失败,因为出方向流量未开通。 |
400 | ResourceNotFound.VpcPeer | The specified resource of %s is not found. | 无法找到指定的VpcPeer |
400 | OperationDenied.RouteTableTypeNotPermitted | The operation is not allowed because the type of route table is not permitted. | 指定路由表类型不允许创建路由条目 |
400 | OperationDenied.GatewayRouteTableNotPermitted | The operation is not allowed to create a route pointing to this nextHop type on gateway route table. | 网关路由表中不支持创建指向此实例类型的路由条目。 |
400 | UnsupportedFeature.VpcPeerIpv6 | IPv6 route entries for VPC peering connections cannot be created in this region. | 此路由器接口对端是VPC,此地域不支持创建此类型下一跳的IPV6路由。 |
400 | OperationDenied.VpcIpv6NotEnabled | IPv6 has not been enabled for the VPC. | 由于该VPC未使能IPV6能力,操作被拒绝。 |
403 | IncorrectInstanceStatus | The current status of the resource does not support this operation. | 当前资源的状态不支持该操作。 |
404 | InvalidInstanId.NotFound | Specified instance does not exist. | 指定的实例不存在,请您检查该实例是否正确。 |
404 | InvalidNextHopId.NotFound | Specified next hop does not exist. | 该下一跳不存在。 |
404 | InvalidRouteTableId.NotFound | Specified route table does not exist. | 该路由表不存在。 |
404 | InvalidHaVipId.NotFound | The specified HaVip does not exist in the specified VPC. | 该HaVip在VPC中不存在。 |
500 | InternalError | The request processing has failed due to some unknown error, exception or failure. | 内部错误 |
500 | IncorrectStatus.Ipv4Gateway | The status of Ipv4Gateway is incorrect. | Ipv4Gateway状态处于非稳态 |
访问错误中心查看更多错误码。