全部产品
Search
文档中心

VPN网关:PublishVpnRouteEntry - 发布或者撤销VPN路由

更新时间:Jun 19, 2026

调用PublishVpnRouteEntry接口将目的路由或策略路由发布到VPC的系统路由表中或将已发布的目的路由或策略路由从VPC系统路由表中撤销。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

调试

授权信息

下表是API对应的授权信息,可以在RAM权限策略语句的Action元素中使用,用来给RAM用户或RAM角色授予调用此API的权限。具体说明如下:

  • 操作:是指具体的权限点。

  • 访问级别:是指每个操作的访问级别,取值为写入(Write)、读取(Read)或列出(List)。

  • 资源类型:是指操作中支持授权的资源类型。具体说明如下:

    • 对于必选的资源类型,用前面加 * 表示。

    • 对于不支持资源级授权的操作,用全部资源表示。

  • 条件关键字:是指云产品自身定义的条件关键字。

  • 关联操作:是指成功执行操作所需要的其他权限。操作者必须同时具备关联操作的权限,操作才能成功。

操作

访问级别

资源类型

条件关键字

关联操作

vpc:PublishVpnRouteEntry

update

*VpnGateway

acs:vpc:{#regionId}:{#accountId}:vpngateway/{#VpnGatewayId}

请求参数

名称

类型

必填

描述

示例值

RegionId

string

VPN 网关实例所在的地域 ID。

您可以通过调用 DescribeRegions 接口获取地域 ID。

cn-hangzhou

ClientToken

string

客户端 Token,用于保证请求的幂等性。

由客户端生成该参数值,要保证在不同请求间唯一,最大值不超过 64 个 ASCII 字符。

说明

若您未指定,则系统自动使用 API 请求的 RequestId 作为 ClientToken 标识。每次 API 请求的 RequestId 不一样。

d7d24a21-f4ba-4454-9173-b382****

VpnGatewayId

string

VPN 网关实例 ID。

vpn-bp1a3kqjiiq9legfx****

RouteDest

string

VPN 网关路由条目的目标网段。

10.0.0.0/24

NextHop

string

VPN 网关路由条目的下一跳。

vco-bp15oes1py4i66rmd****

RouteType

string

VPN 网关路由条目类型。取值:

  • pbr:策略路由。

  • dbr:目的路由。

pbr

PublishVpc

boolean

发布或撤销路由。取值:

  • true:发布。

    该参数取值为 true,表示将目的路由或策略路由发布到 VPC 的系统路由表中。

  • false:撤销。

    该参数取值为 false,表示将已发布的目的路由或策略路由从 VPC 系统路由表中撤销。

说明

如果策略路由表和目的路由表中存在目标网段相同的路由条目,并且这两条路由条目被发布到同一个 VPC 中,当您在策略路由表下撤销发布该路由条目时,目的路由表下的该路由条目也会被同时撤销发布。当您在目的路由表下撤销发布该路由条目时,策略路由表下的该路由条目也会被同时撤销发布。

true

返回参数

名称

类型

描述

示例值

object

返回结果。

RequestId

string

请求 ID。

5BE01CD7-5A50-472D-AC14-CA181C5C03BE

示例

正常返回示例

JSON格式

{
  "RequestId": "5BE01CD7-5A50-472D-AC14-CA181C5C03BE\t"
}

错误码

HTTP status code

错误码

错误信息

描述

400 Resource.QuotaFull The quota of resource is full
400 VpnGateway.Configuring The specified service is configuring.
400 VpnGateway.FinancialLocked The specified service is financial locked.
400 VpnRouteEntry.AlreadyExists The specified route entry is already exist. 该路由已存在。
400 VpnRouteEntry.Conflict The specified route entry has conflict. 路由条目存在冲突。
400 InvalidVpnRouteEntry.NotFound The specified route entry does not exist. 指定的路由条目不存在。
400 OperationFailed.InvalidStatus Route entry is not allowed to operate in current status. 当前状态下禁止操作该路由条目。
400 OperationFailed.RouteConflict Operation failed because there is already a route in VPC route table to another VPN on the same network block. 在VPC路由表中同一网段上已经存在一条指向另一个VPN网关的路由。
400 OperationFailed.InvalidCidrBlock Operation failed because the specified network block is invalid. 网段不合法。
400 QuotaExceeded.VpnRouteEntry The number of route entries to the VPN gateway in the VPC routing table has reached the quota limit. VPC路由表中指向VPN网关的路由条目已经达到配额限制。
400 TaskConflict The operation is too frequent, please wait a moment and try again. 操作过于频繁,请稍等一会再重试
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.
400 InvalidCIDRBlock.Duplicate Specified CIDR block is already exists.
400 IncorrectVpcStatus Current VPC status does not support this operation.
400 IncorrectInstanceStatus Current instance status does not support this operation.
400 IncorrectRouteEntryStatus Some route entry status blocked this operation.
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是云服务地址,您不能再添加该网段指向云下IDC。 4. 除100.64.0.0/10以外,100.64.0.0/11、100.96.0.0/11等明细路由网段均不能使用在云下IDC。
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 INVALID_WEIGHT_PARAM Specified value of weight invalid
400 FORBIDDEN_USE_VPC_AS_INTERNET_GATEWAY The Specified CIDR must be in vpc CIDR.
400 INVALID_VPC_ID The Specified VpcId not match. 该VPC不存在,请您检查输入的VPC是否正确。
400 InvalidRouteEntrySize The Specified routerEntry size not legal. 等价路由需要选择2~4个路由器接口作为路由下一跳。
400 RouteConflict.AlreadyExist Route conflict exists in routing table. 路由表中存在路由冲突。
400 InvalidRouteEntryName.Malformed Specified RouteEntry name is not valid. 无法修改,因为指定的路由条目名称无效
400 Duplicated.VpcNextHop Route entry nexthop duplicate. 下一个重复的路由条目。
400 InvalidNexthop.DirectEni The direct Eni cannot be nexthop. 直通Eni不能作为下一跳
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路由。
403 Forbbiden.SubUser User not authorized to operate on the specified resource as your account is created by another user.
403 Forbidden User not authorized to operate on the specified resource. 您没有权限操作指定资源,请申请权限后再操作。
404 InvalidVpnGatewayInstanceId.NotFound The specified vpn gateway instance id does not exist.

访问错误中心查看更多错误码。

变更历史

更多信息,参考变更详情