華為云計(jì)算 云知識(shí) 查詢(xún)VPN連接列表ListVpnConnections
查詢(xún)VPN連接列表ListVpnConnections

 

功能介紹

查詢(xún)VPN連接列表

URI

GET /v5/{project_id}/vpn-connection

表1 參數(shù)說(shuō)明

名稱(chēng)

類(lèi)型

是否必選

說(shuō)明

project_id

String

項(xiàng)目ID,可以通過(guò)獲取項(xiàng)目ID獲取項(xiàng)目ID。

表2 請(qǐng)求Query參數(shù)列表

名稱(chēng)

類(lèi)型

是否必選

描述

vgw_ip

String

VPN網(wǎng)關(guān)EIP的ID或接入私網(wǎng)IP

vgw_id

String

VPN網(wǎng)關(guān)ID

enterprise_project_id

Array

企業(yè)項(xiàng)目ID

limit

Integer

  • 功能說(shuō)明:分頁(yè)查詢(xún)時(shí)每頁(yè)返回的記錄數(shù)量
  • 取值范圍:0-200
  • 默認(rèn)值:200

marker

String

  • 功能說(shuō)明:查詢(xún)本頁(yè)的起始標(biāo)記位,為空時(shí)為查詢(xún)第一頁(yè)。查詢(xún)下一頁(yè)的marker可以根據(jù)上一頁(yè)響應(yīng)的page_info對(duì)象中的next_marker填寫(xiě)。
  • 約束:必須與limit一起使用。

請(qǐng)求消息

  • 請(qǐng)求參數(shù)

    無(wú)

  • 請(qǐng)求樣例
    1. 查詢(xún)所有VPN連接。
      GET https://{Endpoint}/v5/{project_id}/vpn-connection
    2. 指定vgw_ip查詢(xún)VPN連接。
      GET https://{Endpoint}/v5/{project_id}/vpn-connection?vgw_ip={vgw_ip}&limit={limit}&marker={marker}
    3. 指定VPN網(wǎng)關(guān)實(shí)例查詢(xún)VPN連接。
      GET https://{Endpoint}/v5/{project_id}/vpn-connection?vgw_id={vgw_id}&limit={limit}&marker={marker}

響應(yīng)消息

  • 響應(yīng)參數(shù)

    返回狀態(tài)碼為 200: successful operation

    表3 響應(yīng)Body參數(shù)列表

    名稱(chēng)

    類(lèi)型

    描述

    vpn_connections

    Array of

    ResponseVpnConnection objects

    vpn_connection對(duì)象

    page_info

    PageInfo object

    分頁(yè)信息

    request_id

    String

    請(qǐng)求ID

    total_count

    Long

    租戶(hù)下連接總數(shù)

    表4 ResponseVpnConnection

    名稱(chēng)

    類(lèi)型

    描述

    id

    String

    • 功能說(shuō)明:VPN連接ID
    • 格式:36位UUID

    name

    String

    • 功能說(shuō)明:VPN連接名稱(chēng),不填時(shí)會(huì)自動(dòng)生成
    • 取值范圍:1-64個(gè)字符,支持?jǐn)?shù)字、英文字母、中文(\u4e00 - \u9fa5)、_(下劃線(xiàn))、-(中劃線(xiàn))。

    status

    String

    • 功能說(shuō)明:VPN連接狀態(tài)
    • 取值范圍:

      ERROR:異常

      ACTIVE:正常

      DOWN:未連接

      PENDING_CREATE:創(chuàng)建中

      PENDING_UPDATE:更新中

      PENDING_DELETE:刪除中

      FREEZED:凍結(jié)中

    vgw_id

    String

    • 功能說(shuō)明:VPN網(wǎng)關(guān)ID
    • 格式:36位UUID

    vgw_ip

    String

    • 功能說(shuō)明: VPN網(wǎng)關(guān)EIP的ID或接入私網(wǎng)IP
    • 格式:36位UUID或點(diǎn)分十進(jìn)制IPv4地址(如192.168.45.7)

    style

    String

    • 功能說(shuō)明:連接模式
    • 取值范圍:

      POLICY: 策略模式

      STATIC: 靜態(tài)路由模式

      BGP: bgp路由模式

    cgw_id

    String

    • 功能說(shuō)明:對(duì)端網(wǎng)關(guān)ID
    • 格式:36位UUID

    peer_subnets

    Array of String

    對(duì)端子網(wǎng)。當(dāng)VPN網(wǎng)關(guān)的關(guān)聯(lián)模式為ER并且style字段為BGP或POLICY時(shí)不返回。

    tunnel_local_address

    String

    路由模式下配置在VPN網(wǎng)關(guān)上的tunnel接口地址。僅當(dāng)style為STATIC或BGP時(shí)有效。

    tunnel_peer_address

    String

    路由模式下配置在用戶(hù)側(cè)設(shè)備上的tunnel接口地址。僅當(dāng)style為STATIC或BGP時(shí)有效。

    enable_nqa

    Boolean

    • 功能說(shuō)明:開(kāi)啟NQA檢測(cè)。僅當(dāng)style為STATIC時(shí)返回。
    • 取值范圍:true,false。

    policy_rules

    Array of PolicyRule objects

    策略模式的策略規(guī)則組。當(dāng)style為POLICY時(shí)返回實(shí)際的策略規(guī)則組,當(dāng)style為STATIC或BGP時(shí)不返回。

    ikepolicy

    IkePolicy object

    ike策略對(duì)象

    ipsecpolicy

    IpsecPolicy object

    ipsec策略對(duì)象

    created_at

    String

    創(chuàng)建時(shí)間

    updated_at

    String

    最后一次更新時(shí)間

    enterprise_project_id

    String

    • 功能說(shuō)明:企業(yè)項(xiàng)目ID
    • 格式:36位UUID。與vgw_id所標(biāo)識(shí)VPN網(wǎng)關(guān)的企業(yè)項(xiàng)目ID一致。

    connection_monitor_id

    String

    • 功能說(shuō)明:VPN連接監(jiān)控ID
    • 格式:36位UUID

    ha_role

    String

    • 功能說(shuō)明:主備模式VPN網(wǎng)關(guān)下的連接時(shí),'master'表示主連接,'slave'表示備連接。雙活模式下的連接ha_role都是'master'。
    • 默認(rèn)值:master
    表5 PolicyRule

    名稱(chēng)

    類(lèi)型

    描述

    rule_index

    Integer

    • 功能說(shuō)明:規(guī)則ID
    • 取值范圍:0-50

    source

    String

    源地址網(wǎng)段

    destination

    Array of String

    目的地址網(wǎng)段。單個(gè)網(wǎng)段格式示例:192.168.52.0/24。每個(gè)PolicyRule最多返回50個(gè)。

    表6 IkePolicy

    名稱(chēng)

    類(lèi)型

    描述

    ike_version

    String

    • 功能說(shuō)明:IKE版本號(hào)
    • 取值范圍:v1, v2。

    phase1_negotiation_mode

    String

    • 功能說(shuō)明:協(xié)商模式。僅當(dāng)IKE版本為v1時(shí)返回
    • 取值范圍:

      main:主模式,協(xié)商過(guò)程安全性高。

      aggressive:野蠻模式,協(xié)商快速且協(xié)商成功率高。

    authentication_algorithm

    String

    • 功能說(shuō)明:認(rèn)證算法
    • 取值范圍:sha2-512,sha2-384,sha2-256,sha1,md5,sm3。

    encryption_algorithm

    String

    • 功能說(shuō)明:加密算法
    • 取值范圍:aes-256-gcm-16,aes-128-gcm-16,aes-256,aes-192,aes-128,3des,sm4。

    dh_group

    String

    • 功能說(shuō)明:第一階段密鑰交換使用的DH組,當(dāng)VPN網(wǎng)關(guān)flavor為GM時(shí)不返回。
    • 取值范圍:group1,group2,group5,group14,group15,group16,group19,group20,group21。

    authentication_method

    String

    • 功能說(shuō)明:ike協(xié)商時(shí)的認(rèn)證方法
    • 取值范圍:

      pre-share:預(yù)共享密鑰

    lifetime_seconds

    Integer

    • 功能說(shuō)明:表示SA的生存周期,當(dāng)該生存周期超時(shí)后IKE SA將自動(dòng)更新。
    • 取值范圍:60-604800,單位:秒

    local_id_type

    String

    • 功能說(shuō)明:本端ID類(lèi)型,當(dāng)VPN網(wǎng)關(guān)flavor為GM時(shí)不返回。
    • 取值范圍:ip,fqdn。

    local_id

    String

    本端ID。當(dāng)local_id_type為ip時(shí)返回VPN連接所使用的網(wǎng)關(guān)IP;當(dāng)local_id_type為fqdn時(shí)返回創(chuàng)建或更新VPN連接時(shí)指定的本端ID。

    當(dāng)VPN網(wǎng)關(guān)flavor為GM時(shí)不返回。

    peer_id_type

    String

    • 功能說(shuō)明:對(duì)端ID類(lèi)型,當(dāng)VPN網(wǎng)關(guān)flavor為GM時(shí)不返回。
    • 取值范圍:ip,fqdn。

    peer_id

    String

    對(duì)端ID。當(dāng)peer_id_type為ip時(shí)返回對(duì)端網(wǎng)關(guān)的IP;當(dāng)peer_id_type為fqdn時(shí)返回創(chuàng)建或更新VPN連接時(shí)指定的對(duì)端ID。

    當(dāng)VPN網(wǎng)關(guān)flavor為GM時(shí)不返回。

    dpd

    Dpd object

    對(duì)等體存活檢測(cè)對(duì)象

    表7 Dpd

    名稱(chēng)

    類(lèi)型

    描述

    timeout

    Integer

    • 功能說(shuō)明:對(duì)等體存活檢測(cè)報(bào)文重傳間隔
    • 取值范圍:2-60,單位:秒。

    interval

    Integer

    • 功能說(shuō)明:對(duì)等體存活檢測(cè)空閑時(shí)間
    • 取值范圍:10-3600,單位:秒。

    msg

    String

    • 功能說(shuō)明:對(duì)等體存活檢測(cè)報(bào)文格式
    • 取值范圍:

      seq-hash-notify:指定DPD報(bào)文中的載荷順序是hash-notify。

      seq-notify-hash:指定DPD報(bào)文中的載荷順序是notify-hash。

    表8 IpsecPolicy

    名稱(chēng)

    類(lèi)型

    描述

    authentication_algorithm

    String

    • 功能說(shuō)明:認(rèn)證算法
    • 取值范圍:sha2-512,sha2-384,sha2-256,sha1,md5,sm3。

    encryption_algorithm

    String

    • 功能說(shuō)明:加密算法
    • 取值范圍:aes-256-gcm-16,aes-128-gcm-16,aes-256,aes-192,aes-128,3des,sm4。

    pfs

    String

    • 功能說(shuō)明:PFS使用的DH密鑰組,當(dāng)VPN網(wǎng)關(guān)flavor為GM時(shí)不返回。
    • 取值范圍:group1,group2,group5,group14,group15,group16,group19,group20,group21,disable。

    transform_protocol

    String

    • 功能說(shuō)明:傳輸協(xié)議
    • 取值范圍:

      esp:封裝安全協(xié)議

    lifetime_seconds

    Integer

    • 功能說(shuō)明:表示配置IPSec連接建立的隧道以時(shí)間為基準(zhǔn)的生存周期。
    • 取值范圍:30-604800,單位:秒。

    encapsulation_mode

    String

    • 功能說(shuō)明:報(bào)文封裝模式
    • 取值范圍:

      tunnel:隧道模式

    表9 PageInfo

    名稱(chēng)

    類(lèi)型

    描述

    next_marker

    String

    下一頁(yè)的marker,值為上一次查詢(xún)響應(yīng)中最后一個(gè)資源的創(chuàng)建時(shí)間。

    current_count

    Integer

    當(dāng)前列表中資源數(shù)量。若小于查詢(xún)請(qǐng)求傳入的limit則表示最后一頁(yè)。

  • 響應(yīng)樣例
    1. 查詢(xún)所有VPN連接的響應(yīng)。
      {
          "vpn_connections": [{
                  "id": "228a68f0-****-****-****-a9919a3ea3de",
                  "name": "vpn-56ea",
                  "status": "DOWN",
                  "vgw_id": "ba90819b-****-****-****-3a01622856a5",
                  "vgw_ip": "3ea3b006-****-****-****-ae180ae07885",
                  "style": "STATIC",
                  "cgw_id": "537d9c26-****-****-****-99364a410f00",
                  "peer_subnets": [
                      "192.168.1.0/24"
                  ],
                  "tunnel_local_address": "169.254.149.2/30",
                  "tunnel_peer_address": "169.254.149.1/30",
                  "enable_nqa": true,
                  "ikepolicy": {
                      "ike_version": "v2",
                      "authentication_algorithm": "sha2-256",
                      "encryption_algorithm": "aes-128",
                      "dh_group": "group15",
                      "authentication_method": "pre-share",
                      "lifetime_seconds": 86400,
                      "local_id_type": "ip",
                      "local_id": "10.1.1.216",
                      "peer_id_type": "ip",
                      "peer_id": "10.0.1.67",
                      "dpd": {
                          "timeout": 15,
                          "interval": 30,
                          "msg": "seq-hash-notify"
                      }
                  },
                  "ipsecpolicy": {
                      "authentication_algorithm": "sha2-256",
                      "encryption_algorithm": "aes-128",
                      "pfs": "group15",
                      "transform_protocol": "esp",
                      "lifetime_seconds": 3600,
                      "encapsulation_mode": "tunnel"
                  },
                  "created_at": "2022-12-11T13:59:59.633Z",
                  "updated_at": "2022-12-11T13:59:59.633Z",
                  "enterprise_project_id": "0"
              },
              {
                  "id": "a4df33ca-****-****-****-410a7dd6973f",
                  "name": "vpn-15ea",
                  "status": "DOWN",
                  "vgw_id": "02217fb1-****-****-****-806ea291a8f2",
                  "vgw_ip": "f5acac2c-****-****-****-72b819a5f525",
                  "style": "POLICY",
                  "cgw_id": "10a4496f-****-****-****-7510f4b2af33",
                  "tunnel_local_address": "169.254.77.169/30",
                  "tunnel_peer_address": "169.254.77.170/30",
                  "policy_rules": [{
                      "rule_index": 1,
                      "source": "10.0.0.0/24",
                      "destination": [
                          "192.168.44.0/24"
                      ]
                  }],
                  "ikepolicy": {
                      "ike_version": "v2",
                      "authentication_algorithm": "sha2-256",
                      "encryption_algorithm": "aes-128",
                      "dh_group": "group15",
                      "authentication_method": "pre-share",
                      "lifetime_seconds": 3600,
                      "local_id_type": "ip",
                      "local_id": "88.88.201.167",
                      "peer_id_type": "ip",
                      "peer_id": "10.111.222.21",
                      "dpd": {
                          "interval": 30,
                          "timeout": 15,
                          "msg": "seq-hash-notify"
                      }
                  },
                  "ipsecpolicy": {
                      "authentication_algorithm": "sha2-256",
                      "encryption_algorithm": "aes-128",
                      "pfs": "group15",
                      "transform_protocol": "esp",
                      "lifetime_seconds": 3600,
                      "encapsulation_mode": "tunnel"
                  },
                  "created_at": "2022-12-09T07:24:27.674Z",
                  "updated_at": "2022-12-09T07:24:27.674Z",
                  "enterprise_project_id": "0",
                  "ha_role":"master"
              }
          ],
          "page_info": {
              "next_marker": "2022-12-09T07:24:27.674Z",
              "current_count": 2
          },
          "request_id": "1d94a4e8-fdc2-7bfd-943e-19bfa9b234ac",
          "total_count": 2
      }
    2. 指定vgw_ip查詢(xún)VPN連接的響應(yīng)。
      {
          "vpn_connections": [
              {
                  "id": "8fa335dd-****-****-****-78bb55a8bb04",
                  "name": "vpn-2acd",
                  "status": "DOWN",
                  "vgw_id": "02217fb1-****-****-****-806ea291a8f2",
                  "vgw_ip": "f5acac2c-****-****-****-72b819a5f525",
                  "style": "STATIC",
                  "cgw_id": "eba04567-****-****-****-5b0352f89af0",
                  "peer_subnets": [
                      "192.168.44.0/24"
                  ],
                  "tunnel_local_address": "169.254.58.225/30",
                  "tunnel_peer_address": "169.254.58.226/30",
                  "enable_nqa": false,
                  "ikepolicy": {
                      "ike_version": "v2",
                      "authentication_algorithm": "sha2-256",
                      "encryption_algorithm": "aes-128",
                      "dh_group": "group15",
                      "authentication_method": "pre-share",
                      "lifetime_seconds": 3600,
                      "local_id_type": "ip",
                      "local_id": "88.***.***.167",
                      "peer_id_type": "ip",
                      "peer_id": "10.***.***.9",
                      "dpd": {
                          "timeout": 15,
                          "interval": 30,
                          "msg": "seq-hash-notify"
                      }
                  },
                  "ipsecpolicy": {
                      "authentication_algorithm": "sha2-256",
                      "encryption_algorithm": "aes-128",
                      "pfs": "group15",
                      "transform_protocol": "esp",
                      "lifetime_seconds": 3600,
                      "encapsulation_mode": "tunnel"
                  },
                  "created_at": "2022-12-11T14:24:25.115Z",
                  "updated_at": "2022-12-11T14:24:25.115Z",
                  "enterprise_project_id": "0"
              },
              {
                  "id": "a4df33ca-****-****-****-410a7dd6973f",
                  "name": "vpn-15ea",
                  "status": "DOWN",
                  "vgw_id": "02217fb1-****-****-****-806ea291a8f2",
                  "vgw_ip": "f5acac2c-****-****-****-72b819a5f525",
                  "style": "POLICY",
                  "cgw_id": "10a4496f-****-****-****-7510f4b2af33",
                  "tunnel_local_address": "169.254.77.169/30",
                  "tunnel_peer_address": "169.254.77.170/30",
                  "policy_rules": [
                      {
                          "rule_index": 1,
                          "source": "10.0.0.0/24",
                          "destination": [
                              "192.168.44.0/24"
                          ]
                      }
                  ],
                  "ikepolicy": {
                      "ike_version": "v2",
                      "authentication_algorithm": "sha2-256",
                      "encryption_algorithm": "aes-128",
                      "dh_group": "group15",
                      "authentication_method": "pre-share",
                      "lifetime_seconds": 3600,
                      "local_id_type": "ip",
                      "local_id": "88.88.201.167",
                      "peer_id_type": "ip",
                      "peer_id": "10.111.222.21",
                      "dpd": {
                          "interval": 30,
                          "timeout": 15,
                          "msg": "seq-hash-notify"
                      }
                  },
                  "ipsecpolicy": {
                      "authentication_algorithm": "sha2-256",
                      "encryption_algorithm": "aes-128",
                      "pfs": "group15",
                      "transform_protocol": "esp",
                      "lifetime_seconds": 3600,
                      "encapsulation_mode": "tunnel"
                  },
                  "created_at": "2022-12-11T13:59:59.633Z",
                  "updated_at": "2022-12-11T13:59:59.633Z",
                  "enterprise_project_id": "0",
                  "ha_role":"master"
              }
          ],
          "page_info": {
              "next_marker": "2022-12-11T13:59:59.633Z",
              "current_count": 2
          },
          "request_id": "1d94a4e8-fdc2-7bfd-943e-19bfa9b234ac",
          "total_count": 12
      }
    3. 指定VPN網(wǎng)關(guān)實(shí)例查詢(xún)VPN連接的響應(yīng)。
      {
          "vpn_connections": [
              {
                  "id": "8fa335dd-****-****-****-78bb55a8bb04",
                  "name": "vpn-2acd",
                  "status": "DOWN",
                  "vgw_id": "02217fb1-****-****-****-806ea291a8f2",
                  "vgw_ip": "f5acac2c-****-****-****-72b819a5f525",
                  "style": "STATIC",
                  "cgw_id": "eba04567-****-****-****-5b0352f89af0",
                  "peer_subnets": [
                      "192.168.44.0/24"
                  ],
                  "tunnel_local_address": "169.254.58.225/30",
                  "tunnel_peer_address": "169.254.58.226/30",
                  "enable_nqa": false,
                  "ikepolicy": {
                      "ike_version": "v2",
                      "authentication_algorithm": "sha2-256",
                      "encryption_algorithm": "aes-128",
                      "dh_group": "group15",
                      "authentication_method": "pre-share",
                      "lifetime_seconds": 3600,
                      "local_id_type": "ip",
                      "local_id": "88.***.***.167",
                      "peer_id_type": "ip",
                      "peer_id": "10.***.***.9",
                      "dpd": {
                          "timeout": 15,
                          "interval": 30,
                          "msg": "seq-hash-notify"
                      }
                  },
                  "ipsecpolicy": {
                      "authentication_algorithm": "sha2-256",
                      "encryption_algorithm": "aes-128",
                      "pfs": "group15",
                      "transform_protocol": "esp",
                      "lifetime_seconds": 3600,
                      "encapsulation_mode": "tunnel"
                  },
                  "created_at": "2022-12-11T14:24:25.115Z",
                  "updated_at": "2022-12-11T14:24:25.115Z",
                  "enterprise_project_id": "0",
                  "ha_role":"master"
              },
              {
                  "id": "a4df33ca-****-****-****-410a7dd6973f",
                  "name": "vpn-15ea",
                  "status": "DOWN",
                  "vgw_id": "02217fb1-****-****-****-806ea291a8f2",
                  "vgw_ip": "f5acac2c-****-****-****-72b819a5f525",
                  "style": "POLICY",
                  "cgw_id": "10a4496f-****-****-****-7510f4b2af33",
                  "tunnel_local_address": "169.254.77.169/30",
                  "tunnel_peer_address": "169.254.77.170/30",
                  "policy_rules": [
                      {
                          "rule_index": 1,
                          "source": "10.0.0.0/24",
                          "destination": [
                              "192.168.44.0/24"
                          ]
                      }
                  ],
                  "ikepolicy": {
                      "ike_version": "v2",
                      "authentication_algorithm": "sha2-256",
                      "encryption_algorithm": "aes-128",
                      "dh_group": "group15",
                      "authentication_method": "pre-share",
                      "lifetime_seconds": 3600,
                      "local_id_type": "ip",
                      "local_id": "88.88.201.167",
                      "peer_id_type": "ip",
                      "peer_id": "10.111.222.21",
                      "dpd": {
                          "interval": 30,
                          "timeout": 15,
                          "msg": "seq-hash-notify"
                      }
                  },
                  "ipsecpolicy": {
                      "authentication_algorithm": "sha2-256",
                      "encryption_algorithm": "aes-128",
                      "pfs": "group15",
                      "transform_protocol": "esp",
                      "lifetime_seconds": 3600,
                      "encapsulation_mode": "tunnel"
                  },
                  "created_at": "2022-12-11T13:59:59.633Z",
                  "updated_at": "2022-12-11T13:59:59.633Z",
                  "enterprise_project_id": "0",
                  "ha_role":"master"
              }
          ],
          "page_info": {
              "next_marker": "2022-12-11T13:59:59.633Z",
              "current_count": 2
          },
          "request_id": "1d94a4e8-fdc2-7bfd-943e-19bfa9b234ac",
          "total_count": 12
      }

狀態(tài)碼

請(qǐng)參見(jiàn)狀態(tài)碼