调用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代码示例。
请求参数
名称 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
Action | String | 是 | CreateIpsecServer |
系统规定参数。取值:CreateIpsecServer。 |
RegionId | String | 是 | cn-hangzhou |
VPN网关所属地域ID。 |
VpnGatewayId | String | 是 | vpn-bp17lofy9fd0dnvzv**** |
VPN网关实例ID。 |
LocalSubnet | String | 是 | 192.168.0.0/24 |
本端网段,指需要和客户端网段互连的VPC侧的网段。 多个网段之间用半角逗号(,)分隔,例如:192.168.1.0/24,192.168.2.0/24。 |
ClientIpPool | String | 是 | 10.0.0.0/24 |
客户端网段,指给客户端虚拟网卡分配访问地址的地址段。 说明 客户端网段不能和VPC侧网段冲突。
|
IpSecServerName | String | 否 | test |
IPsec服务端名称。 名称长度为1~100个字符,不能以 |
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 | 否 | Cfd123**** |
预共享密钥。 用于IPsec服务端与客户端之间的身份认证。密钥长度为1~100个字符。 若您未指定预共享密钥,系统会随机生成一个16位的字符串作为预共享密钥。您可以调用ListIpsecServers接口查询系统生成的密钥信息。 说明 IPsec服务端的预共享密钥需和客户端的认证密钥一致,否则IPsec服务端和客户端之间无法建立连接。
|
ClientToken | String | 否 | d7d24a21-f4ba-4454-9173-b38**** |
客户端Token,用于保证请求的幂等性。 从您的客户端生成一个参数值,确保不同请求间该参数值唯一。ClientToken只支持ASCII字符。 说明 若您未指定,则系统自动使用API请求的RequestId作为ClientToken标识。每次API请求的RequestId可能不一样。
|
DryRun | String | 否 | false |
是否只预检此次请求,取值:
|
返回数据
名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
CreationTime | String | 2021-02-22T03:24:28Z |
IPsec服务端创建时间。 T表示分隔符,Z表示的是UTC,即世界标准时间。 |
IpsecServerId | String | iss-bp1jougp8cfsbo8y9**** |
IPsec服务端ID。 |
RequestId | String | 690A967E-D4CD-4B69-8C78-94FE828BA10B |
请求ID。 |
IpsecServerName | String | test |
IPsec服务端名称。 |
VpnGatewayId | String | vpn-bp17lofy9fd0dnvzv**** |
VPN网关实例ID。 |
RegionId | String | cn-hangzhou |
VPN网关所属地域ID。 |
示例
请求示例
http(s)://[Endpoint]/?Action=CreateIpsecServer
&RegionId=cn-hangzhou
&VpnGatewayId=vpn-bp17lofy9fd0dnvzv****
&LocalSubnet=192.168.0.0/24
&ClientIpPool=10.0.0.0/24
&IpSecServerName=test
&EffectImmediately=true
&IkeConfig={"IkeVersion":"ikev2","IkeMode":"main","IkeEncAlg":"aes","IkeAuthAlg":"sha1","IkePfs":"group2","IkeLifetime":86400}
&IpsecConfig={"IpsecEncAlg":"aes","IpsecAuthAlg":"sha1","IpsecPfs":"group2","IpsecLifetime":86400}
&PskEnabled=true
&Psk=Cfd123****
&ClientToken=d7d24a21-f4ba-4454-9173-b38****
&DryRun=false
&公共请求参数
正常返回示例
XML
格式
HTTP/1.1 200 OK
Content-Type:application/xml
<CreateIpsecServerResponse>
<CreationTime>2021-02-22T03:24:28Z</CreationTime>
<IpsecServerId>iss-bp1jougp8cfsbo8y9****</IpsecServerId>
<RequestId>690A967E-D4CD-4B69-8C78-94FE828BA10B</RequestId>
<IpsecServerName>test</IpsecServerName>
<VpnGatewayId>vpn-bp17lofy9fd0dnvzv****</VpnGatewayId>
<RegionId>cn-hangzhou</RegionId>
</CreateIpsecServerResponse>
JSON
格式
HTTP/1.1 200 OK
Content-Type:application/json
{
"CreationTime" : "2021-02-22T03:24:28Z",
"IpsecServerId" : "iss-bp1jougp8cfsbo8y9****",
"RequestId" : "690A967E-D4CD-4B69-8C78-94FE828BA10B",
"IpsecServerName" : "test",
"VpnGatewayId" : "vpn-bp17lofy9fd0dnvzv****",
"RegionId" : "cn-hangzhou"
}
错误码
HttpCode | 错误码 | 错误信息 | 描述 |
---|---|---|---|
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 | 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 | 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. | 对该实例的操作过于频繁,请稍后重试。 |
访问错误中心查看更多错误码。