Modifies the configuration of an IPsec-VPN connection.

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 ModifyVpnConnectionAttribute

The operation that you want to perform.

Set the value to ModifyVpnConnectionAttribute.

RegionId String Yes cn-shanghai

The ID of the region where the IPsec-VPN connection is established.

You can call the DescribeRegions operation to query the most recent region list.

ClientToken String No 02fb3da4-130e-11e9-8e44-0016e04115b

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 the value is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length.

VpnConnectionId String Yes vco-bp1bbi27hojx80nck****

The ID of the IPsec-VPN connection.

Name String No IPsec

The name of the IPsec-VPN connection.

The name must be 2 to 128 characters in length and can contain digits, periods (.), underscores (_), and hyphens (-). The name must start with a letter but cannot start with http:// or https://.

LocalSubnet String No 10.1.1.0/24,10.1.2.0/24

The CIDR block of the virtual private cloud (VPC) to be connected to the data center. This CIDR block is used in Phase 2 negotiations.

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

RemoteSubnet String No 10.2.1.0/24,10.2.2.0/24

The CIDR block of the data center. This CIDR block is used in Phase 2 negotiations.

Separate CIDR blocks with commas (,). Example: 192.168.3.0/24,192.168.4.0/24.

EffectImmediately Boolean No false

Specifies whether to delete the current IPsec tunnel and initiate negotiations again. Valid values:

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

The configuration of Phase 1 negotiations:

  • IkeConfig.Psk: The pre-shared key that is used for authentication between the VPN gateway and the data center. The key must be 1 to 100 characters in length.

    If you do not specify a pre-shared key, the system generates a random 16-bit string as the pre-shared key. You can call the DescribeVpnConnection operation to query the pre-shared key that is generated by the system.
    Note The pre-shared key of the IPsec-VPN connection must be the same as the authentication key of the data center. Otherwise, you cannot establish a connection between the data center and the VPN gateway.
  • IkeConfig.IkeVersion: the version of the IKE protocol. Valid values: ikev1 and ikev2. Default value: ikev1.
  • IkeConfig.IkeMode: the negotiation mode of IKE V1. Valid values: main and aggressive. Default value: main.
  • IkeConfig.IkeEncAlg: the encryption algorithm that is used in Phase 1 negotiations. Valid values: aes, aes192, aes256, des, and 3des. Default value: aes.
  • IkeConfig.IkeAuthAlg: the authentication algorithm that is used in Phase 1 negotiations. Valid values: md5 and sha1. Default value: sha.
  • IkeConfig.IkePfs: The Diffie-Hellman (DH) key exchange algorithm that is used in Phase 1 negotiations. Valid values: group1, group2, group5, group14, and group24. Default value: group2.
  • IkeConfig.IkeLifetime: the security association (SA) lifetime that is determined by Phase 1 negotiations. Unit: seconds. Valid values: 0 to 86400. Default value: 86400.
  • IkeConfig.LocalIdIPsec: the identifier of the VPN gateway. The identifier cannot exceed 100 characters in length. The default value is the public IP address of the VPN gateway.
  • IkeConfig.RemoteId: the identifier of the customer gateway. The identifier cannot exceed 100 characters in length. The default value is the public IP address of the customer gateway.
IpsecConfig String No {"IpsecEncAlg":"aes","IpsecAuthAlg":"sha1","IpsecPfs":"group2","IpsecLifetime":86400}

The configuration of Phase 2 negotiations:

  • IpsecConfig.IpsecEncAlg: the encryption algorithm that is used in Phase 2 negotiations. Valid values: aes, aes192, aes256, des, and 3des. Default value: aes.
  • IpsecConfig. IpsecAuthAlg: the authentication algorithm that is used in Phase 2 negotiations. Valid values: md5 and sha1. Default value: sha1.
  • IpsecConfig. IpsecPfs: the Diffie-Hellman key exchange algorithm that is used in Phase 2 negotiations. If you specify this parameter, packets of all protocols are forwarded. Valid values: group1, group2, group5, group14, and group24. Default value: group2.
  • IpsecConfig. IpsecLifetime: the SA lifetime determined by Phase 2 negotiations. Unit: seconds. Valid values: 0 to 86400. Default value: 86400.
HealthCheckConfig String No {"enable":"true","dip":"192.168.XX.XX","sip":"192.168.XX.XX","interval":"3","retry":"3"}

The health check configuration:

  • HealthCheckConfig.enable: specifies whether to enable health checks. Valid values: true and false. Default value: false.
  • HealthCheckConfig.dip: the destination IP address that is used for health checks.
  • HealthCheckConfig.sip: the source IP address that is used for health checks.
  • HealthCheckConfig.interval: the interval between two consecutive health checks. Unit: seconds.
  • HealthCheckConfig.retry: the maximum number of health check retries.
AutoConfigRoute Boolean No true

Specifies whether to automatically advertise routes. Valid values:

  • true (default): automatically advertises routes.
  • false: does not automatically advertise routes.
EnableDpd Boolean No true

Specifies whether to enable the dead peer detection (DPD) feature. Valid values:

  • true (default): enables DPD. The initiator of the IPsec-VPN connection sends DPD packets to verify the existence and availability of the peer. If no response is received from the peer within a specified period of time, the connection fails. ISAKMP SAs and IPsec SAs are deleted. The IPsec tunnel is also deleted.
  • false: disables DPD. The IPsec initiator does not send DPD packets.
EnableNatTraversal Boolean No true

Specifies whether to enable NAT traversal. Valid values:

  • true (default): enables NAT traversal. After NAT traversal is enabled, the initiator does not check the UDP ports during IKE negotiations and can automatically discover NAT gateway devices along the IPsec tunnel.
  • false: disables NAT traversal.
BgpConfig String No {"EnableBgp":"true","LocalAsn":"45104","TunnelCidr":"169.254.11.0/30","LocalBgpIp":"169.254.11.1"}

The Border Gateway Protocol (BGP) configuration:

  • BgpConfig.EnableBgp: specifies whether to enable BGP. Valid values: true and false. Default value: false.
  • BgpConfig.LocalAsn: the autonomous system number (ASN) of Alibaba Cloud. Valid values: 1 to 4294967295. Default value: 45104.
  • BgpConfig.TunnelCidr: the CIDR block of the IPsec tunnel. The CIDR block must belong to 169.254.0.0/16. The subnet mask of the CIDR block must be 30 bits in length.
  • LocalBgpIp: the BGP IP address of Alibaba Cloud. This IP address must fall within the CIDR block of the IPsec tunnel.
Note
  • This parameter is required when the VPN gateway has dynamic BGP enabled.
  • We recommend that you use a private ASN to establish a connection with Alibaba Cloud over BGP. Refer to the relevant documentation for the private ASN range.
RemoteCaCertificate String No c20ycDI1NnYxIENBIChURVNUIFN****

The certificate authority (CA) certificate of the peer when a ShangMi (SM) VPN gateway is used to create the IPsec-VPN connection.

  • This parameter is required when an SM VPN gateway is used to create the IPsec-VPN connection.
  • You can ignore this parameter when a standard VPN gateway is used to create the IPsec-VPN connection.

Response parameters

Parameter Type Example Description
EnableNatTraversal Boolean true

Indicates whether NAT traversal is enabled. Valid values:

  • false: disabled.
  • true: enabled.
CreateTime Long 1492753817000

The timestamp generated when the IPsec-VPN connection was created.

EffectImmediately Boolean false

Indicates whether the IPsec-VPN connection immediately takes effect. Valid values:

  • true: immediately initiates negotiations after the configuration is completed.
  • false: initiates negotiations when inbound traffic is detected. This is the default value.
VpnGatewayId String vpn-bp1q8bgx4xnkm2ogj****

The ID of the VPN gateway.

LocalSubnet String 10.1.1.0/24,10.1.2.0/24

The CIDR block of the VPC.

RequestId String 7DB79D0C-5F27-4AB5-995B-79BE55102F90

The ID of the request.

VpnConnectionId String vco-bp1bbi27hojx80nck****

The ID of the IPsec-VPN connection.

Description String description

The description of the IPsec-VPN connection.

RemoteSubnet String 10.2.1.0/24,10.2.2.0/24

The CIDR block of the data center.

CustomerGatewayId String vpn-bp1q8bgx4xnkm2ogj****

The ID of the customer gateway.

Name String test

The name of the IPsec-VPN connection.

EnableDpd Boolean true

Indicates whether DPD is enabled. Valid values:

  • false: disabled.
  • true: enabled.
IkeConfig Object

The configuration of Phase 1 negotiations.

RemoteId String 139.18.XX.XX

The peer ID. The default value is the IP address of the customer gateway. The ID is a fully qualified domain name (FQDN) or an IP address.

IkeLifetime Long 86400

The IKE lifetime. Unit: seconds.

IkeEncAlg String aes

The IKE encryption algorithm.

LocalId String 116.64.XX.XX

The local ID. The default value is the IP address of the VPN gateway. The ID is an FQDN or an IP address.

IkeMode String main

The IKE mode.

IkeVersion String ikev1

The IKE version.

IkePfs String group2

The DH group.

Psk String pgw6dy7d1i8i****

The pre-shared key.

IkeAuthAlg String sha1

The IKE authentication algorithm.

IpsecConfig Object

The configuration of Phase 2 negotiations.

IpsecAuthAlg String sha1

The IPsec authentication algorithm.

IpsecLifetime Long 86400

The IPsec lifetime. Unit: seconds.

IpsecEncAlg String aes

The IPsec encryption algorithm.

IpsecPfs String group2

The DH group.

VcoHealthCheck Object

The health check configurations.

Dip String 1.2.XX.XX

The destination IP address.

Interval Integer 3

The interval between two consecutive health checks. Unit: seconds.

Retry Integer 1

The maximum number of health check retries.

Sip String 2.1.XX.XX

The source IP address.

Enable String true

Indicates whether the health check feature is enabled. Valid values:

  • true: enabled.
  • false: disabled.
VpnBgpConfig Object

The BGP configuration.

Status String success

The negotiation status of BGP. Valid values:

  • success: normal
  • false: abnormal
PeerBgpIp String 169.23.XX.XX

The BGP IP address of the data center.

TunnelCidr String 169.254.11.0/30

The CIDR block of the IPsec tunnel.

EnableBgp String true

Indicates whether BGP is enabled. Valid values:

  • true: enabled.
  • false: disabled.
LocalBgpIp String 169.35.XX.XX

The BGP IP address of Alibaba Cloud.

PeerAsn Integer 65531

The ASN of the data center.

LocalAsn Integer 45104

The ASN of Alibaba Cloud.

Examples

Sample requests

https://vpc.aliyuncs.com/?Action=ModifyVpnConnectionAttribute
&RegionId=cn-shanghai
&VpnConnectionId=vco-bp1bbi27hojx80nck****
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<ModifyVpnConnectionAttributeResponse>
    <EnableNatTraversal>true</EnableNatTraversal>
    <CreateTime>1492753817000</CreateTime>
    <EffectImmediately>false</EffectImmediately>
    <VpnGatewayId>vpn-bp1q8bgx4xnkm2ogj****</VpnGatewayId>
    <LocalSubnet>10.1.1.0/24,10.1.2.0/24</LocalSubnet>
    <RequestId>7DB79D0C-5F27-4AB5-995B-79BE55102F90</RequestId>
    <VpnConnectionId>vco-bp1bbi27hojx80nck****</VpnConnectionId>
    <Description>description</Description>
    <RemoteSubnet>10.2.1.0/24,10.2.2.0/24</RemoteSubnet>
    <CustomerGatewayId>vpn-bp1q8bgx4xnkm2ogj****</CustomerGatewayId>
    <Name>test</Name>
    <EnableDpd>true</EnableDpd>
    <IkeConfig>
        <RemoteId>139.18.XX.XX</RemoteId>
        <IkeLifetime>86400</IkeLifetime>
        <IkeEncAlg>aes</IkeEncAlg>
        <LocalId>116.64.XX.XX</LocalId>
        <IkeMode>main</IkeMode>
        <IkeVersion>ikev1</IkeVersion>
        <IkePfs>group2</IkePfs>
        <Psk>pgw6dy7d1i8i****</Psk>
        <IkeAuthAlg>sha1</IkeAuthAlg>
    </IkeConfig>
    <IpsecConfig>
        <IpsecAuthAlg>sha1</IpsecAuthAlg>
        <IpsecLifetime>86400</IpsecLifetime>
        <IpsecEncAlg>aes</IpsecEncAlg>
        <IpsecPfs>group2</IpsecPfs>
    </IpsecConfig>
    <VcoHealthCheck>
        <Dip>1.2.XX.XX</Dip>
        <Interval>3</Interval>
        <Retry>1</Retry>
        <Sip>2.1.XX.XX</Sip>
        <Enable>true</Enable>
    </VcoHealthCheck>
    <VpnBgpConfig>
        <Status>success</Status>
        <PeerBgpIp>169.23.XX.XX</PeerBgpIp>
        <TunnelCidr>169.254.11.0/30</TunnelCidr>
        <EnableBgp>true</EnableBgp>
        <LocalBgpIp>169.35.XX.XX</LocalBgpIp>
        <PeerAsn>65531</PeerAsn>
        <LocalAsn>45104</LocalAsn>
    </VpnBgpConfig>
</ModifyVpnConnectionAttributeResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "EnableNatTraversal" : true,
  "CreateTime" : 1492753817000,
  "EffectImmediately" : false,
  "VpnGatewayId" : "vpn-bp1q8bgx4xnkm2ogj****",
  "LocalSubnet" : "10.1.1.0/24,10.1.2.0/24",
  "RequestId" : "7DB79D0C-5F27-4AB5-995B-79BE55102F90",
  "VpnConnectionId" : "vco-bp1bbi27hojx80nck****",
  "Description" : "description",
  "RemoteSubnet" : "10.2.1.0/24,10.2.2.0/24",
  "CustomerGatewayId" : "vpn-bp1q8bgx4xnkm2ogj****",
  "Name" : "test",
  "EnableDpd" : true,
  "IkeConfig" : {
    "RemoteId" : "139.18.XX.XX",
    "IkeLifetime" : 86400,
    "IkeEncAlg" : "aes",
    "LocalId" : "116.64.XX.XX",
    "IkeMode" : "main",
    "IkeVersion" : "ikev1",
    "IkePfs" : "group2",
    "Psk" : "pgw6dy7d1i8i****",
    "IkeAuthAlg" : "sha1"
  },
  "IpsecConfig" : {
    "IpsecAuthAlg" : "sha1",
    "IpsecLifetime" : 86400,
    "IpsecEncAlg" : "aes",
    "IpsecPfs" : "group2"
  },
  "VcoHealthCheck" : {
    "Dip" : "1.2.XX.XX",
    "Interval" : 3,
    "Retry" : 1,
    "Sip" : "2.1.XX.XX",
    "Enable" : "true"
  },
  "VpnBgpConfig" : {
    "Status" : "success",
    "PeerBgpIp" : "169.23.XX.XX",
    "TunnelCidr" : "169.254.11.0/30",
    "EnableBgp" : "true",
    "LocalBgpIp" : "169.35.XX.XX",
    "PeerAsn" : 65531,
    "LocalAsn" : 45104
  }
}

Error codes

HttpCode Error code Error message Description
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 before you enable the service.
400 InvalidName The name is not valid The error message returned because the format of the name is invalid.
400 VpnRouteEntry.Conflict The specified route entry has conflict. The error message returned the specified route conflicts with an existing route.
400 QuotaExceeded.PolicyBasedRoute The maximum number of policy-based routes is exceeded. Existing routes: %s. Routes to be created: %s. Maximum routes: %s. The error message returned because the number of policy-based routes reaches the upper limit. The maximum number of routes that you can create is %s. The number of existing routes is %s. You are creating %s routes.
400 IllegalParam.LocalSubnet The specified "LocalSubnet" (%s) is invalid. The error message returned because LocalSubnet is set to an invalid value.
400 IllegalParam.RemoteSubnet The specified "RemoteSubnet" (%s) is invalid. The error message returned because RemoteSubnet is set to an invalid value.
400 OperationFailed.CenLevelNotSupport When the VPC to which the VPN gateway belongs is attached to a FULL-mode CEN, the VPN gateway cannot enable BGP. The error message returned because you cannot enable BGP for a VPN gateway when the Cloud Enterprise Network (CEN) instance to which the VPC of the VPN gateway is attached has the FULL mode enabled.
403 Forbbiden.SubUser User not authorized to operate on the specified resource as your account is created by another user. The error message returned because you are unauthorized to perform this operation on the specified resource. Acquire the required permissions and try again.
403 Forbidden User not authorized to operate on the specified resource. The error message returned because you are unauthorized to perform the operation on the specified resource. Acquire the required permissions and try again.
404 InvalidVpnConnectionInstanceId.NotFound The specified vpn connection instance id does not exist. The error message returned because the specified IPsec-VPN connection does not exist. Check whether the ID of the IPsec-VPN connection is valid.

For a list of error codes, visit the Error Center.