You can call this operation to query the details 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 DescribeVpnConnection

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

RegionId String Yes cn-hangzhou

The region ID of the IPsec VPN connection.

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

VpnConnectionId String Yes vco-bp1bbi27hojx80nck****

The ID of the IPsec VPN connection.

Response parameters

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

The ID of the IPsec VPN connection.

CustomerGatewayId String cgw-bp1mvj4g9kogwwcxk****

The ID of the customer gateway.

VpnGatewayId String vpn-bp1q8bgx4xnkm2ogj****

The ID of the VPN gateway.

Name String ipsec1

The name of the IPsec VPN connection.

LocalSubnet String 1.1.1.0/24

The CIDR block of the VPC.

RemoteSubnet String 1.1.1.0/24

The CIDR block of the on-premises data center.

CreateTime Long 1492753817000

The time when the IPsec VPN connection was created.

Status String ike_sa_not_established

The status of the connection.

  • ike_sa_not_established: Phase 1 negotiations failed.
  • ike_sa_established: Phase 1 negotiations were successful.
  • ipsec_sa_not_established: Phase 2 negotiations failed.
  • ipsec_sa_established: Phase 2 negotiations were successful.
EffectImmediately Boolean true

Indicates whether the IPsec VPN connection takes effect immediately.

  • true: A reconnection is triggered when the configuration is changed.
  • false: A reconnection is triggered when network traffic is detected. Reconnections may cause transient disconnections.
EnableDpd Boolean true

Indicates whether dead peer detection (DPD) is enabled.

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

The IPsec initiator sends DPD packets to check the existence and availability of the IPsec peer. 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.

EnableNatTraversal Boolean true

Indicates whether to enable the NAT traversal feature.

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

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.

IkeConfig Struct

The configurations of Phase 1 negotiations.

IkeAuthAlg String sha1

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

IkeEncAlg String aes

The IKE encryption algorithm.

IkeLifetime Long 86400

The IKE lifetime.

IkeMode String main

The IKE mode. Both main and aggressive modes are supported. The main mode features high security. If NAT traversal is enabled, we recommend that you select the aggressive mode.

IkePfs String group2

The DH group.

IkeVersion String ikev1

The IKE version.

LocalId String 116.62.69.xxx

The local ID of the VPN 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 pgw6dy7d1i8in7x5

The pre-shared key.

RemoteId String 139.196.32.xxx

The peer ID. The default value is the IP address of the customer gateway. Both 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 F2310D45-BCF6-4E2E-9082-B4503844BA4C

The ID of the request.

VcoHealthCheck Struct

The health check information.

Dip String 10.0.0.xx

The destination IP address specified for health checks.

Enable String true

Indicates whether to enable health checks.

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

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

Retry Integer 3

The maximum number of attempts for resending health check probes.

Sip String 192.168.1.xx

The source IP address specified for health checks.

Status String failed

The status of the health check.

VpnBgpConfig Struct

BGP configuration information.

EnableBgp String true

The status of BGP.

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

The local autonomous system number.

LocalBgpIp String 169.254.11.1

The local BGP IP address.

PeerAsn String 10002

The peer autonomous system number.

PeerBgpIp String 169.254.11.2

The peer BGP IP address.

Status String true

The negotiation status of BGP.

  • success
  • false
TunnelCidr String 169.254.11.0/30

The CIDR block of the IPsec tunnel.

Examples

Sample requests

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

Sample success response

XML format

<DescribeVpnConnectionResponse>
  <LocalSubnet>10.0.0.0/8</LocalSubnet>
  <Status>ipsec_sa_established</Status>
  <RequestId>6FBAE985-A938-49CB-9129-621AA3A88728</RequestId>
  <CustomerGatewayId>cgw-gw8usu4zsk23pf69f****</CustomerGatewayId>
  <CreateTime>1590495160000</CreateTime>
  <Name>VPN1-CGW22</Name>
  <EffectImmediately>false</EffectImmediately>
  <RemoteSubnet>192.168.0.0/16</RemoteSubnet>
  <VcoHealthCheck>
        <Status>success</Status>
        <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>10001</PeerAsn>
        <LocalBgpIp>169.254.10.1</LocalBgpIp>
  </VpnBgpConfig>
</DescribeVpnConnectionResponse>

JSON format

{
    "LocalSubnet": "10.0.0.0/8",
    "Status": "ipsec_sa_established",
    "RequestId": "6FBAE985-A938-49CB-9129-621AA3A88728",
    "CustomerGatewayId": "cgw-gw8usu4zsk23pf69f****",
    "CreateTime": 1590495160000,
    "Name": "VPN1-CGW22",
    "EffectImmediately": false,
    "RemoteSubnet": "192.168.0.0/16",
    "VcoHealthCheck": {
        "Status": "success",
        "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": 10001,
        "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.
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.

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