调用CreateIpsecServer接口创建IPsec服务端。
接口说明
- 创建IPsec服务端前,您需要先创建VPN网关并确保已开启VPN网关的SSL-VPN功能。具体操作,请参见CreateVpnGateway。
- CreateIpsecServer接口属于异步接口,即系统先返回一个实例ID,但该IPsec服务端尚未创建成功,系统后台的创建任务仍在进行。您可以调用DescribeVpnGateway查询VPN网关实例的状态,来确定IPsec服务端的创建状态:
- 当VPN网关实例处于updating状态时,表示IPsec服务端正在创建中。
- 当VPN网关实例处于active状态时,表示IPsec服务端创建成功。
- CreateIpsecServer接口不支持在同一VPN网关下并发创建IPsec服务端。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
授权信息
请求参数
名称 | 类型 | 必填 | 描述 | 示例值 |
---|---|---|---|---|
RegionId | string | 是 | VPN网关所属地域ID。 | cn-hangzhou |
VpnGatewayId | string | 是 | VPN网关实例ID。 | vpn-bp17lofy9fd0dnvzv**** |
LocalSubnet | string | 是 | 本端网段,指需要和客户端网段互连的VPC侧的网段。 多个网段之间用半角逗号(,)分隔,例如:192.168.1.0/24,192.168.2.0/24。 | 192.168.0.0/24 |
ClientIpPool | string | 是 | 客户端网段,指给客户端虚拟网卡分配访问地址的地址段。 说明
客户端网段不能和VPC侧网段冲突。
| 10.0.0.0/24 |
IpSecServerName | string | 否 | IPsec服务端名称。 名称长度为1~100个字符,不能以 | test |
EffectImmediately | boolean | 否 | 配置是否立即生效。取值:
| true |
IkeConfig | string | 否 | 第一阶段协商参数配置。取值:
| {"IkeVersion":"ikev2","IkeMode":"main","IkeEncAlg":"aes","IkeAuthAlg":"sha1","IkePfs":"group2","IkeLifetime":86400} |
IpsecConfig | string | 否 | 第二阶段协商参数配置。取值:
| {"IpsecEncAlg":"aes","IpsecAuthAlg":"sha1","IpsecPfs":"group2","IpsecLifetime":86400} |
PskEnabled | boolean | 否 | 是否开启预共享密钥认证方式。取值:true,表示开启预共享密钥认证方式。 | true |
Psk | string | 否 | 预共享密钥。 用于IPsec服务端与客户端之间的身份认证。密钥长度为1~100个字符。 若您未指定预共享密钥,系统会随机生成一个16位的字符串作为预共享密钥。您可以调用ListIpsecServers接口查询系统生成的密钥信息。 说明
IPsec服务端的预共享密钥需和客户端的认证密钥一致,否则IPsec服务端和客户端之间无法建立连接。
| Cfd123**** |
ClientToken | string | 否 | 客户端Token,用于保证请求的幂等性。 从您的客户端生成一个参数值,确保不同请求间该参数值唯一。ClientToken只支持ASCII字符。 说明
若您未指定,则系统自动使用API请求的RequestId作为ClientToken标识。每次API请求的RequestId不一样。
| d7d24a21-f4ba-4454-9173-b38**** |
DryRun | string | 否 | 是否只预检此次请求,取值:
| false |
返回参数
示例
正常返回示例
JSON
格式
{
"CreationTime": "2021-02-22T03:24:28Z",
"IpsecServerId": "iss-bp1jougp8cfsbo8y9****",
"RequestId": "690A967E-D4CD-4B69-8C78-94FE828BA10B",
"IpsecServerName": "test",
"VpnGatewayId": "vpn-bp17lofy9fd0dnvzv****",
"RegionId": "cn-hangzhou"
}
错误码
HTTP status code | 错误码 | 错误信息 | 描述 |
---|---|---|---|
400 | OperationUnsupported.IPsecServer | The current version of the VPN gateway does not support IPsec server. | 当前VPN网关版本不支持IPsec服务端。 |
400 | VpnGateway.SslVpnDisabled | The VPN gateway has not enabled SSL VPN. | VPN网关没有开启SSL VPN功能。 |
400 | VpnGateway.Configuring | The specified service is configuring. | 服务正在配置中,请您稍后再试。 |
400 | VpnGateway.FinancialLocked | The specified service is financial locked. | 该服务已欠费,请您先充值再操作。 |
400 | OperationFailed.IPsecServerExist | An IPsec server already exists in the VPN gateway. | VPN网关中已经存在一个IPsec服务端。 |
400 | OperationUnsupported.IpsecPfs | The specified IPsec Pfs is unsupported. | 不支持指定的IPsec Pfs |
400 | IllegalParam.AuthMethod | One authentication method (Psk or IDaaS) should be specified at least. | 至少有一种认证方法(Psk或者IDaas)应该被指定 |
400 | IllegalParam.LocalSubnet | The specified "LocalSubnet" (%s) is invalid. | 本端网段(%s)不合法。 |
400 | IllegalParam.ClientIpPool | The specified ClientIpPool (%s) is invalid. | 客户端网段(%s)不合法。 |
400 | MissingParam.IDaaSInstanceId | The input parameter IDaaSInstanceId is mandatory when enable multi-factor authentication. | 当开启双因子认证时,IDaaS实例ID是必填的参数 |
400 | OperationFailed.NoRamPermission | Vpn Service has no permission to operate your IDaaS instances. | Vpn服务没有权限操作您的IDaaS实例 |
400 | ClientIpPool.NetmaskInvalid | The netmask length of client IP pool must be greater than or equal to 16 and less than or equal to 29. | 客户端 IP 池的网络掩码长度必须大于等于 16 且小于等于 29。 |
400 | VpnRouteEntry.Conflict | The specified client IP pool conflicts with VPN connection or SSL server. | 指定的客户端 IP 池与 VPN 连接或 SSL 服务端冲突。 |
400 | ClientIpPool.SubnetInvalid | The specified client IP pool cannot be used. | 当前客户端网段不可用。 |
400 | InvalidClientIpPool.Conflict | The specified client IP pool conflicts with other resources in the same VPC. | 客户端网段与VPC内其他资源冲突。 |
400 | OperationFailed.AddVpcRoute | It is failed to add VPC route after this operation. | 此操作后添加 VPC 路由失败。 |
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 | SystemBusy | The system is busy. Please try again later. | 当前系统繁忙,请稍后重试。 |
403 | Forbidden | User not authorized to operate on the specified resource. | 您没有权限操作指定资源,请申请权限后再操作。 |
404 | InvalidVpnGatewayInstanceId.NotFound | The specified vpn gateway instance id does not exist. | 指定的 VPN 网关不存在,请您检查 VPN 网关是否正确。 |
404 | InvalidIDaaSInstanceId.NotFound | The specified IDaaS instance ID does not exist. | 指定的IDaaS实例ID不存在 |
409 | OperationConflict | The operation against this instance is too frequent, please try again later. | 对该实例的操作过于频繁,请稍后重试。 |
访问错误中心查看更多错误码。