華為云計(jì)算 云知識(shí) 查詢VPN連接ShowVpnConnection
查詢VPN連接ShowVpnConnection

 

功能介紹

根據(jù)連接ID,查詢指定的VPN連接的參數(shù)。

URI

GET /v5/{project_id}/vpn-connection/{vpn_connection_id}

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

名稱

類(lèi)型

是否必選

說(shuō)明

project_id

String

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

vpn_connection_id

String

VPN連接ID

請(qǐng)求消息

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

    無(wú)

  • 請(qǐng)求樣例
    GET https://{Endpoint}/v5/{project_id}/vpn-connection/{vpn_connection_id}

響應(yīng)消息

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

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

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

    名稱

    類(lèi)型

    描述

    vpn_connection

    ResponseVpnConnection object

    vpn_connection對(duì)象

    request_id

    String

    請(qǐng)求ID

    表3 ResponseVpnConnection

    名稱

    類(lèi)型

    描述

    id

    String

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

    name

    String

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

    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

    路由模式下配置在用戶側(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
    表4 PolicyRule

    名稱

    類(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è)。

    表5 IkePolicy

    名稱

    類(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ù)共享密鑰

      digital-envelope-v2:國(guó)密數(shù)字信封

    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ì)象

    表6 Dpd

    名稱

    類(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。

    表7 IpsecPolicy

    名稱

    類(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:隧道模式

  • 響應(yīng)樣例
    {
        "vpn_connection": {
            "id": "98c5af8a-****-****-****-ae2280a6f4c3",
            "name": "vpn-1655",
            "status": "DOWN",
            "vgw_id": "b32d91a4-****-****-****-e907174eb11d",
            "vgw_ip": "0c464dad-****-****-****-c22bb0eb0bde",
            "style": "POLICY",
            "cgw_id": "5247ae10-****-****-****-dd36659a7f5d",
            "peer_subnets": ["192.168.0.0/24"],
            "tunnel_local_address": "169.254.56.225/30",
            "tunnel_peer_address": "169.254.56.226/30",
            "policy_rules": [{
                "rule_index": 1,
                "source": "10.0.0.0/24",
                "destination": [
                    "192.168.0.0/24"
                ]
            }],
            "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.***.***.134",
                "peer_id_type": "ip",
                "peer_id": "88.***.***.164",
                "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-11-26T13:41:34.626Z",
            "updated_at": "2022-11-26T13:41:34.626Z",
            "enterprise_project_id": "0",
            "ha_role":"master"
        },
        "request_id": "f91082d4-6d49-479c-ad1d-4e552a9f5cae"
    }

狀態(tài)碼

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