You can call this operation to modify 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 region ID of the IPsec VPN connection.

You can call the DescribeRegions operation to query the region ID.

VpnConnectionId String Yes vco-bp1bbi27hojx80nck****

The name of the IPsec VPN connection.

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

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

The value of this parameter is generated by a client. The value must be unique among different requests and must be 1 to 64 ASCII characters in length.

Name String No IPsec

The name of the IPsec VPN connection.

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

LocalSubnet String No 1.1.1.0/24,1.1.2.0/24

The CIDR block of the VPC to be connected with the on-premises data center. This parameter is used for Phase 2 negotiations.

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

RemoteSubnet String No 1.1.1.0/24,1.1.2.0/24

The CIDR block of the on-premises data center. This parameter is used for Phase 2 negotiations.

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

EffectImmediately Boolean No false

Specifies whether to delete a negotiated IPsec VPN tunnel and initiate a negotiation again. Valid values:

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

The configurations of Phase 1 negotiations:

  • IkeConfig.Psk: the pre-shared key used for authentication between the IPsec VPN gateway and the customer gateway. By default, a random value is generated. You can also specify a pre-shared key. The key can be up to 100 characters in length.
  • IkeConfig.IkeVersion: the version of the IKE protocol. Valid values: IKEv1 | IKEv2. Default value: IKEv1.
  • IkeConfig.IkeMode: the negotiation mode of IKE V1. Valid values: main | aggressive. Default value: main.
  • IkeConfig.IkeEncAlg: the encryption algorithm used in Phase 1 negotiations. Valid values: AES | AES192 | AES256 | DES | 3DES. Default value: AES.
  • IkeConfig.IkeAuthAlg: the authentication algorithm used in Phase 1 negotiations. Valid values: MD5 | SHA1. Default value: SHA1.

    IkeConfig.IkePfs: the Diffie-Hellman key exchange algorithm used in Phase 1 negotiations. Valid values: Group1 | Group2 | Group5 | Group14 | Group24. Default value: Group2.

  • IkeConfig.IkeLifetime: the SA lifetime as a result of Phase 1 negotiations. Valid values: 0 to 86400. Unit: seconds. Default value: 86400.
  • IkeConfig.LocalIdIPsec: the identifier of the VPN gateway. This parameter can contain up to 100 characters. By default, it is the public IP address of the VPN gateway.
  • IkeConfig.RemoteId: the identifier of the customer gateway. This parameter can contain up to 100 characters. The default value is the public IP address of the customer gateway.
IpsecConfig String No {"IpsecEncAlg":"aes","IpsecAuthAlg":"sha1","IpsecPfs":"group2","IpsecLifetime":86400}

The configurations of Phase 2 negotiations.

  • IpsecConfig.IpsecEncAlg: the encryption algorithm used in Phase 2 negotiations. Valid values: AES | AES192 | AES256 | DES | 3DES. Default value: AES.
  • IpsecConfig. IpsecAuthAlg: the authentication algorithm used in Phase 2 negotiations. Valid values: MD5 | SHA1. Default value: SHA1.
  • IpsecConfig. IpsecPfs: the Diffie-Hellman group for perfect forward secrecy (PFS). The Diffie-Hellman key exchange algorithm used in Phase 1 negotiations. Valid values: Group1 | Group2 | Group5 | Group14 | Group24. Default value: Group2.
  • IpsecConfig. IpsecLifetime: the SA lifetime as a result of Phase 2 negotiations. Valid values: 0 to 86400. Unit: seconds. Default value: 86400.
HealthCheckConfig String No {"enable":"true","dip":"192.168.xx.2","sip":"192.168.xx.2","interval":"3","retry":"3"}

The health check configurations:

  • HealthCheckConfig.enable: specifies whether to enable health checks. Valid values: true|false (default).
  • HealthCheckConfig.dip: the destination IP address that is configured for health checks.
  • HealthCheckConfig.sip: the source IP address that is configured for health checks.
  • HealthCheckConfig.interval: the interval between health check retries. Unit: seconds.
  • HealthCheckConfig.retry: the maximum number of health check retries.
AutoConfigRoute Boolean No true

Specifies whether to automatically propagate routes. Valid values:

  • true (default): Routes are automatically propagated.
  • false: Routes are not automatically propagated.
EnableDpd Boolean No true

Specifies whether dead peer detection (DPD) is enabled. Valid values:

  • true(Default): enables the DPD feature. The IPsec initiator sends DPD packets to verify the existence and availability of IPsec peers. If no feedback is received from the peer within a specified period of time, the IPsec initiator will disconnect the IPsec tunnel. ISAKMP SA and the corresponding IPsec SA are deleted. The security tunnel is also deleted.
  • false: disables the DPD feature. The IPsec initiator does not send DPD packets.
EnableNatTraversal Boolean No true

Specifies whether to enable the NAT traversal feature. Valid values:

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

BGP configurations:

  • BgpConfig.EnableBgp: specifies whether to enable Border Gateway Protocol (BGP). Valid values: true | false.
  • BgpConfig.LocalAsn: the local autonomous system number.
  • BgpConfig.TunnelCidr: the IPsec tunnel CIDR block. The mask length of the CIDR block in 169.254.0.0/16 is 30.
  • LocalBgpIp: the local BGP IP address. This IP address is within the IPsec tunnel CIDR block.

Response parameters

Parameter Type Example Description
VpnConnectionId String vco-bp1bbi27hojx80nck****

The name of the IPsec VPN connection.

CustomerGatewayId String vpn-bp1q8bgx4xnkm2ogj****

The ID of the customer gateway.

VpnGatewayId String vpn-bp1q8bgx4xnkm2ogj****

The ID of the VPN gateway.

Name String test

The name of the IPsec VPN connection.

LocalSubnet String 1.1.1.0/24,1.1.2.0/24

The CIDR block of the VPC.

RemoteSubnet String 1.1.1.0/24,1.1.2.0/24

The CIDR block of the on-premises data center.

CreateTime Long 1492753817000

The time when the IPsec VPN connection was created.

Description String description

The description of the IPsec VPN connection.

EffectImmediately Boolean false

Indicates whether the IPsec VPN connection takes effect.

  • true: initiates negotiations after the configuration is complete.
  • false (default): initiates negotiations when inbound traffic is detected.
EnableDpd Boolean true

Indicates whether to enable DPD.

  • false: DPD is disabled.
  • true: DPD is enabled.
EnableNatTraversal Boolean true

indicates whether to enable the NAT traversal feature.

  • false: The NAT traversal feature is disabled.
  • true: The NAT traversal feature is enabled.
IkeConfig Struct

The configurations of Phase 1 negotiations.

IkeAuthAlg String sha1

The IKE authentication algorithm.

IkeEncAlg String aes

The IKE encryption algorithm.

IkeLifetime Long 86400

The IKE lifetime.

IkeMode String main

The IKE mode.

IkePfs String group2

The DH group.

IkeVersion String ikev1

The IKE version.

LocalId String 116.xx.xx.64

The ID of the local gateway. The default value is the IP address of the VPN gateway. Both fully qualified domain name (FQDN) and IP address formats are supported.

Psk String pgw6dy7d1i8i****

The pre-shared key.

RemoteId String 139.xx.xx.167

The ID of the peer. By default, it is the IP address of the customer gateway. Both fully qualified domain name (FQDN) and IP address formats are supported.

IpsecConfig Struct

The configurations of Phase 2 negotiations.

IpsecAuthAlg String sha1

The IPsec authentication algorithm. Both SHA1 and MD5 are supported.

IpsecEncAlg String aes

The IPsec encryption algorithm.

IpsecLifetime Long 86400

The IPsec lifetime.

IpsecPfs String group2

The DH group.

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

The ID of the request.

VcoHealthCheck Struct

The health check configurations.

Dip String 1.1.1.xx

The destination IP address configured for health checks.

Enable String true

Specifies whether to enable the health check function.

  • true: Health checks are enabled.
  • false: Health checks are disabled.
Interval Integer 3

The time interval between two consecutive health check retries. Unit: seconds.

Retry Integer 1

The number of attempts for resending health check probes.

Sip String 2.2.2.xx

The source IP address configured for health checks.

VpnBgpConfig Struct

BGP configuration information.

EnableBgp String true

The status of BGP.

  • true: enabled.
  • false: disabled.
LocalAsn Integer 10001

Local autonomous system number.

LocalBgpIp String 169.254.11.1

The local BGP IP address.

PeerAsn Integer 10002

Peer autonomous system number.

PeerBgpIp String 169.254.11.2

The BGP IP address of the peer.

Status String success

The negotiation status of BGP.

  • success: BGP is normal.
  • false: A BGP error occurred.
TunnelCidr String 169.254.11.0/30

The IPsec tunnel CIDR block.

Examples

Sample requests

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

Sample success response

XML format

<ModifyVpnConnectionAttributeResponse>
  <LocalSubnet>10.0.0.0/8</LocalSubnet>
  <RequestId>89C9783E-A2D7-4F07-96CF-6C65C0E50BD3</RequestId>
  <CustomerGatewayId>cgw-gw8usu4zsk23pf69f****</CustomerGatewayId>
  <CreateTime>1590495160000</CreateTime>
  <Name>VPN1-CGW22</Name>
  <EffectImmediately>false</EffectImmediately>
  <RemoteSubnet>192.168.0.0/16</RemoteSubnet>
  <VcoHealthCheck>
        <Enable>false</Enable>
        <Dip></Dip>
        <Sip></Sip>
        <Retry>0</Retry>
        <Interval>0</Interval>
  </VcoHealthCheck>
  <VpnGatewayId>vpn-gw8bvv722zwjht7ia****</VpnGatewayId>
  <IpsecConfig>
        <IpsecPfs>group2</IpsecPfs>
        <IpsecEncAlg>aes</IpsecEncAlg>
        <IpsecAuthAlg>sha1</IpsecAuthAlg>
        <IpsecLifetime>86400</IpsecLifetime>
  </IpsecConfig>
  <VpnConnectionId>vco-gw8tylx7hvwhl7tu8****</VpnConnectionId>
  <EnableNatTraversal>true</EnableNatTraversal>
  <EnableDpd>true</EnableDpd>
  <IkeConfig>
        <IkeAuthAlg>sha1</IkeAuthAlg>
        <LocalId>8.xx.xx.192</LocalId>
        <IkeEncAlg>aes</IkeEncAlg>
        <IkeVersion>ikev1</IkeVersion>
        <IkeMode>main</IkeMode>
        <IkeLifetime>86400</IkeLifetime>
        <Psk>123456</Psk>
        <RemoteId>8.xx.xx.146</RemoteId>
        <IkePfs>group2</IkePfs>
  </IkeConfig>
  <VpnBgpConfig>
        <Status>success</Status>
        <EnableBgp>true</EnableBgp>
        <LocalAsn>10001</LocalAsn>
        <TunnelCidr>169.254.10.0/30</TunnelCidr>
        <PeerBgpIp>169.254.10.2</PeerBgpIp>
        <PeerAsn>10002</PeerAsn>
        <LocalBgpIp>169.254.10.1</LocalBgpIp>
  </VpnBgpConfig>
</ModifyVpnConnectionAttributeResponse>

JSON format

{
    "LocalSubnet": "10.0.0.0/8",
    "RequestId": "89C9783E-A2D7-4F07-96CF-6C65C0E50BD3",
    "CustomerGatewayId": "cgw-gw8usu4zsk23pf69f****",
    "CreateTime": 1590495160000,
    "Name": "VPN1-CGW22",
    "EffectImmediately": false,
    "RemoteSubnet": "192.168.0.0/16",
    "VcoHealthCheck": {
        "Enable": "false",
        "Dip": "",
        "Sip": "",
        "Retry": 0,
        "Interval": 0
    },
    "VpnGatewayId": "vpn-gw8bvv722zwjht7ia****",
    "IpsecConfig": {
        "IpsecPfs": "group2",
        "IpsecEncAlg": "aes",
        "IpsecAuthAlg": "sha1",
        "IpsecLifetime": 86400
    },
    "VpnConnectionId": "vco-gw8tylx7hvwhl7tu8****",
    "EnableNatTraversal": true,
    "EnableDpd": true,
    "IkeConfig": {
        "IkeAuthAlg": "sha1",
        "LocalId": "8.xx.xx.192",
        "IkeEncAlg": "aes",
        "IkeVersion": "ikev1",
        "IkeMode": "main",
        "IkeLifetime": 86400,
        "Psk": "123456",
        "RemoteId": "8.xx.xx.146",
        "IkePfs": "group2"
    },
    "VpnBgpConfig": {
        "Status": "success",
        "EnableBgp": "true",
        "LocalAsn": 10001,
        "TunnelCidr": "169.254.10.0/30",
        "PeerBgpIp": "169.254.10.2",
        "PeerAsn": 10002,
        "LocalBgpIp": "169.254.10.1"
    }
}

Error codes

HTTP status code Error code Error message Description
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 not authorized to perform this operation on the specified resource. You can apply for the permission and try again.
403 Forbidden User not authorized to operate on the specified resource. The error message returned because you are not authorized to perform this operation on the specified resource. To require the permission, submit a ticket.
404 InvalidVpnConnectionInstanceId.NotFound The specified vpn connection instance id does not exist. The error message returned because the specified VPN connection does not exist. You can check whether the configuration of the VPN connection is valid.
400 VpnGateway.Configuring The specified service is configuring. The error message returned because 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 overdue. Add funds before you enable the service.
400 InvalidName The name is not valid The error message returned because the format of the specified name parameter is invalid.
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 routing entries has reached the upper limit. The maximum number of entries that you can create is %s. The number of existing entries is %s. You are now creating %s entries.

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