Creates an IPsec server.

Description

  • Before you create an IPsec server, you must create a VPN gateway and enable the SSL-VPN feature for the VPN gateway. For more information, see CreateVpnGateway.
  • The CreateIpsecServer operation is asynchronous. After you send the request, the system returns a request ID. However, the operation is still being performed in the system background. You can call the DescribeVpnGateway operation to query the status of a VPN gateway.
    • If the VPN gateway is in the updating state, the IPsec server is being created.
    • If the VPN gateway is in the active state, the IPsec server is created.
  • You cannot repeatedly call CreateIpsecServer to create an IPsec server for a VPN gateway within the specified period of time.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes CreateIpsecServer

The operation that you want to perform. Set the value to CreateIpsecServer.

RegionId String Yes cn-hangzhou

The ID of the region where the VPN gateway is deployed.

VpnGatewayId String Yes vpn-bp17lofy9fd0dnvzv****

The ID of the VPN gateway.

LocalSubnet String Yes 192.168.0.0/24

The local CIDR blocks, which refer to the CIDR blocks on the virtual private cloud (VPC) side.

Separate multiple CIDR blocks with commas (,). Example: 192.168.1.0/24,192.168.2.0/24.

ClientIpPool String Yes 10.0.0.0/24

The client CIDR block. It refers to the CIDR block that is used to allocate an IP address to the client.

Note The client CIDR block must not overlap with the CIDR block of the virtual private cloud (VPC).
IpSecServerName String No test

The name of the IPsec server.

The name must be 1 to 100 characters in length and cannot start with http:// or https://.

EffectImmediately Boolean No true

Specifies whether you want the configuration to immediately take effect. Valid values:

  • true: initiates negotiations after the configuration is completed.
  • false (default): initiates negotiations when inbound traffic is detected.
IkeConfig String No {"IkeVersion":"ikev2","IkeMode":"main","IkeEncAlg":"aes","IkeAuthAlg":"sha1","IkePfs":"group2","IkeLifetime":86400}

The configuration of Phase 1 negotiations. Valid values:

  • IkeVersion: the IKE version. Valid values: ikev1 and ikev2. Default value: ikev2.
  • IkeMode: the IKE negotiation mode. Default value: main.
  • IkeEncAlg: the encryption algorithm that is used in Phase 1 negotiations. Default value: aes.
  • IkeAuthAlg: the authentication algorithm that is used in Phase 1 negotiations. Default value: sha1.
  • IkePfs: the Diffie-Hellman key exchange algorithm that is used in Phase 1 negotiations. Default value: group2.
  • IkeLifetime: the security association (SA) lifetime determined by Phase 1 negotiations. Unit: seconds. Valid values: 0 to 86400. Default value: 86400.
  • LocalId: the identifier of the IPsec server. The value can be a fully qualified domain name (FQDN) or an IP address. The default value is the public IP address of the VPN gateway.
  • RemoteId: the identifier of the peer. The value can be an FQDN or an IP address. By default, this parameter is not specified.
IpsecConfig String No {"IpsecEncAlg":"aes","IpsecAuthAlg":"sha1","IpsecPfs":"group2","IpsecLifetime":86400}

The configuration of Phase 2 negotiations. Valid values:

  • IpsecEncAlg: the encryption algorithm that is used in Phase 2 negotiations. Default value: aes.
  • IpsecAuthAlg: the authentication algorithm that is used in Phase 2 negotiations. Default value: sha1.
  • IpsecPfs: forwards packets of all protocols. The Diffie-Hellman key exchange algorithm used in Phase 2 negotiations. Default value: group2.
  • IpsecLifetime: the SA lifetime determined by Phase 2 negotiations. Unit: seconds. Valid values: 0 to 86400. Default value: 86400.
PskEnabled Boolean No true

Specifies whether to enable pre-shared key authentication. If you set the value to true, pre-shared key authentication is enabled.

Psk String No Cfd123****

The pre-shared key.

The pre-shared key is used for identity authentication between the IPsec server and the client. The key must be 1 to 100 characters in length.

If you do not specify a pre-shared key, the system randomly generates a 16-character string as the pre-shared key. You can call the ListIpsecServers operation to query the pre-shared keys that are generated by the system.

Note The pre-shared key of the IPsec server must be the same as the authentication key of the client. Otherwise, a connection cannot be established between the IPsec server and the client.
ClientToken String No d7d24a21-f4ba-4454-9173-b38****

The client token that is used to ensure the idempotence of the request.

You can use the client to generate the value, but you must make sure that it is unique among different requests. ClientToken can contain only ASCII characters.

Note If you do not set this parameter, ClientToken is set to the value of RequestId. The value of RequestId may be different for each API request.
DryRun String No false

Specifies whether to check the request without performing the operation. Valid values:

  • true: only prechecks the request. After the request passes the precheck, the system does not create the IPsec server. The system checks the required parameters, the request format, and the service limits. If the request fails the precheck, an error code is returned. If the request passes the precheck, the DryRunOperation error code is returned.
  • false (default): prechecks the request. After the request passes the precheck, the system creates the IPsec server.

Response parameters

Parameter Type Example Description
CreationTime String 2021-02-22T03:24:28Z

The time when the IPsec server was created.

T is used as a delimiter. Z indicates that the time is in UTC.

IpsecServerId String iss-bp1jougp8cfsbo8y9****

The ID of the IPsec server.

RequestId String 690A967E-D4CD-4B69-8C78-94FE828BA10B

The ID of the request.

IpsecServerName String test

The name of the IPsec server.

VpnGatewayId String vpn-bp17lofy9fd0dnvzv****

The ID of the VPN gateway.

RegionId String cn-hangzhou

The ID of the region where the VPN gateway is deployed.

Examples

Sample requests

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
&<Common request parameters>

Sample success responses

XML format

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 format

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"
}

Error codes

HttpCode Error code Error message Description
400 OperationUnsupported.IPsecServer The current version of the VPN gateway does not support IPsec server. The error message returned because the version of the VPN gateway does not support IPsec servers.
400 VpnGateway.SslVpnDisabled The VPN gateway has not enabled SSL VPN. The error message returned because the SSL-VPN feature is disabled for the VPN gateway.
400 VpnGateway.Configuring The specified service is configuring. The error message returned because the operation is not allowed when the specified service is being configured. Try again later.
400 VpnGateway.FinancialLocked The specified service is financial locked. The error message returned because the service is suspended due to overdue payments. Top up your account balance first.
400 OperationFailed.IPsecServerExist An IPsec server already exists in the VPN gateway. The error message returned because an IPsec server is already associated with the specified VPN gateway.
400 OperationUnsupported.IpsecPfs The specified IPsec Pfs is unsupported. The error message returned because the specified IPsec PFS property is not supported.
400 IllegalParam.AuthMethod One authentication method (Psk or IDaaS) should be specified at least. The error message returned because you must specify at least one authentication method, such as PSK or IDaaS.
400 IllegalParam.LocalSubnet The specified "LocalSubnet" (%s) is invalid. The error message returned because LocalSubnet is set to an invalid value: %s.
400 MissingParam.IDaaSInstanceId The input parameter IDaaSInstanceId is mandatory when enable multi-factor authentication. The error message returned because you must specify the IDaaS instance ID when two-factor authentication is enabled.
400 OperationFailed.NoRamPermission Vpn Service has no permission to operate your IDaaS instances. The error message returned because the VPN service does not have the permissions to manage your IDaaS instance.
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. The error message returned because the subnet mask of the client IP pool must range from 16 to 29.
400 VpnRouteEntry.Conflict The specified client IP pool conflicts with VPN connection or SSL server. The error message returned because the specified client IP pool conflicts with the VPN connection or the SSL server.
400 ClientIpPool.SubnetInvalid The specified client IP pool cannot be used. The error message returned because the client CIDR block is unavailable.
400 InvalidClientIpPool.Conflict The specified client IP pool conflicts with other resources in the same VPC. The error message returned because the client CIDR block conflicts with resources in the VPC.
400 QuotaExceeded.VpnRouteEntry The number of route entries to the VPN gateway in the VPC routing table has reached the quota limit. The error message returned because the number of routes that point to the VPN gateway in the VPC route table has reached the upper limit.
400 SystemBusy The system is busy. Please try again later. The error message returned because the system is unavailable. Try again later.
403 Forbidden User not authorized to operate on the specified resource. The error message returned because you are unauthorized to perform this operation on the specified resource. Acquire the required permissions and try again.
404 InvalidVpnGatewayInstanceId.NotFound The specified vpn gateway instance id does not exist. The error message returned because the specified VPN gateway does not exist. Check whether the specified VPN gateway is valid.
404 InvalidIDaaSInstanceId.NotFound The specified IDaaS instance ID does not exist. The error message returned because the specified IDaaS instance does not exist.
409 OperationConflict The operation against this instance is too frequent, please try again later. The error message returned because operations are performed on the instance at a high frequency. Try again later.

For a list of error codes, see Service error codes.