All Products
Search
Document Center

Virtual Private Cloud:CreateIpsecServer

Last Updated:Dec 06, 2023

Creates an IPsec server.

Operation 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.

  • CreateIpsecServer is an asynchronous operation. After a request is sent, the system returns a request ID and runs the task in the background. You can call DescribeVpnGateway to query the status of the task:

    • 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 the CreateIpsecServer operation for the same VPN gateway within the specified period of time.

debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

debugging

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringYes

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

cn-hangzhou
VpnGatewayIdstringYes

The ID of the VPN gateway.

vpn-bp17lofy9fd0dnvzv****
LocalSubnetstringYes

The local CIDR blocks, which are the CIDR blocks of the virtual private cloud (VPC) for the client to access.

Multiple CIDR blocks are separated with commas (,). Example: 192.168.1.0/24,192.168.2.0/24.

192.168.0.0/24
ClientIpPoolstringYes

The client CIDR block from which an IP address is allocated to the virtual network interface controller (NIC) of the client.

Note The client CIDR block must not overlap with the CIDR blocks of the VPC.
10.0.0.0/24
IpSecServerNamestringNo

The IPsec server name.

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

test
EffectImmediatelybooleanNo

Specify whether to start connection negotiations immediately. Valid values:

  • true: immediately initiates negotiations after the configuration is complete.
  • false (default): initiates negotiations when inbound traffic is detected. This is the default value.
true
IkeConfigstringNo

The configuration of Phase 1 negotiation. 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 negotiation. Default value: aes.
  • IkeAuthAlg: the authentication algorithm that is used in Phase 1 negotiation. Default value: sha1.
  • IkePfs: the Diffie-Hellman key exchange algorithm that is used in Phase 1 negotiation. Default value: group2.
  • IkeLifetime: the security association (SA) lifetime determined by Phase 1 negotiation. 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 peer identifier. The value can be an FQDN or an IP address. The default value is empty.
{"IkeVersion":"ikev2","IkeMode":"main","IkeEncAlg":"aes","IkeAuthAlg":"sha1","IkePfs":"group2","IkeLifetime":86400}
IpsecConfigstringNo

The configuration of Phase 2 negotiation. Valid values:

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

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

true
PskstringNo

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 client key. Otherwise, the IPsec server cannot be connected to the client.
Cfd123****
ClientTokenstringNo

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

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

Note If you do not specify this parameter, the system automatically uses the request ID as the client token. The request ID may be different for each request.
d7d24a21-f4ba-4454-9173-b38****
DryRunstringNo

Specifies whether to only precheck this request. Valid values:

  • true: prechecks the request without creating the IPsec server. The system checks the required parameters, request format, and service limits. If the request fails to pass the precheck, an error code is returned. If the request passes the precheck, the DryRunOperation error code is returned.
  • false (default): sends the request. This is the default value. If the request passes the precheck, the system creates the IPsec server.
false

Response parameters

ParameterTypeDescriptionExample
object

The returned results.

CreationTimestring

The time when the IPsec server was created.

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

2021-02-22T03:24:28Z
IpsecServerIdstring

The IPsec server ID.

iss-bp1jougp8cfsbo8y9****
RequestIdstring

The request ID.

690A967E-D4CD-4B69-8C78-94FE828BA10B
IpsecServerNamestring

The IPsec server name.

test
VpnGatewayIdstring

The ID of the VPN gateway.

vpn-bp17lofy9fd0dnvzv****
RegionIdstring

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

cn-hangzhou

Examples

Sample success responses

JSONformat

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

HTTP status codeError codeError messageDescription
400OperationUnsupported.IPsecServerThe current version of the VPN gateway does not support IPsec server.The current version of the VPN gateway does not support IPsec server.
400VpnGateway.SslVpnDisabledThe VPN gateway has not enabled SSL VPN.The SSL-VPN feature is disabled for the VPN gateway.
400VpnGateway.ConfiguringThe specified service is configuring.The service is being configured. Try again later.
400VpnGateway.FinancialLockedThe specified service is financial locked.The service is suspended due to overdue payments. Top up your account first.
400OperationFailed.IPsecServerExistAn IPsec server already exists in the VPN gateway.An IPsec server already exists in the VPN gateway.
400OperationUnsupported.IpsecPfsThe specified IPsec Pfs is unsupported.The specified IPsec PFS property is not supported.
400IllegalParam.AuthMethodOne authentication method (Psk or IDaaS) should be specified at least.You must specify at least one authentication method, such as PSK or IDaaS.
400IllegalParam.LocalSubnetThe specified "LocalSubnet" (%s) is invalid.The specified "LocalSubnet" (%s) is invalid.
400IllegalParam.ClientIpPoolThe specified ClientIpPool (%s) is invalid.The client CIDR block (%s) is invalid.
400MissingParam.IDaaSInstanceIdThe input parameter IDaaSInstanceId is mandatory when enable multi-factor authentication.You must specify the IDaaS instance ID when two-factor authentication is enabled.
400OperationFailed.NoRamPermissionVpn Service has no permission to operate your IDaaS instances.The VPN service does not have the permissions to manage your IDaaS instance.
400ClientIpPool.NetmaskInvalidThe netmask length of client IP pool must be greater than or equal to 16 and less than or equal to 29.The subnet mask of the client IP pool must range from 16 to 29.
400VpnRouteEntry.ConflictThe specified client IP pool conflicts with VPN connection or SSL server.The specified client IP pool conflicts with the VPN connection or the SSL server.
400ClientIpPool.SubnetInvalidThe specified client IP pool cannot be used.The client CIDR block is unavailable.
400InvalidClientIpPool.ConflictThe specified client IP pool conflicts with other resources in the same VPC.The client CIDR block conflicts with resources in the VPC.
400OperationFailed.AddVpcRouteIt is failed to add VPC route after this operation.VPC routes failed to be added after the operation is performed.
400QuotaExceeded.VpnRouteEntryThe number of route entries to the VPN gateway in the VPC routing table has reached the quota limit.The number of route entries to the VPN gateway in the VPC routing table has reached the quota limit.
400SystemBusyThe system is busy. Please try again later.The system is busy. Please try again later.
400EnableHaCheck.IpsecServerCidrContainsVpcRouteDestIpsec server client cidr contains vpc route prefix. The vpc route prefix is %s.The prefix %s in the VPC route table falls within the CIDR block of the IPsec client.
403ForbiddenUser not authorized to operate on the specified resource.You do not have the permissions to manage the specified resource. Apply for the permissions and try again.
404InvalidVpnGatewayInstanceId.NotFoundThe specified vpn gateway instance id does not exist.The specified VPN gateway does not exist. Check whether the specified VPN gateway is valid.
404InvalidIDaaSInstanceId.NotFoundThe specified IDaaS instance ID does not exist.The specified IDaaS instance does not exist.
409OperationConflictThe operation against this instance is too frequent, please try again later.Operations are too frequently performed on the instance. Try again later.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2023-10-19API Description Update,The error codes of the API operation change.see changesets
Change itemChange content
API DescriptionAPI Description Update
Error CodesThe error codes of the API operation change.
    Error Codes 400 change
    delete Error Codes: 403
    delete Error Codes: 404
    delete Error Codes: 409