華為云計(jì)算 云知識(shí) 查詢(xún)子網(wǎng)NeutronShowSubnet
查詢(xún)子網(wǎng)NeutronShowSubnet

 

功能介紹

查詢(xún)子網(wǎng)詳情

調(diào)試

您可以在API Explorer中調(diào)試該接口。

URI

GET /v2.0/subnets/{subnet_id}

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

無(wú)。

請(qǐng)求示例

GET https://{Endpoint}/v2.0/subnets/011fc878-5521-4654-a1ad-f5b0b5820302

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

表1 響應(yīng)參數(shù)

參數(shù)名稱(chēng)

類(lèi)型

說(shuō)明

subnet

subnet object

subnet對(duì)象,參見(jiàn)表2。

表2 subnet對(duì)象

屬性

類(lèi)型

說(shuō)明

id

String

子網(wǎng)的id

【使用說(shuō)明】在查詢(xún)子網(wǎng)列表時(shí)非必選

name

String

子網(wǎng)的名稱(chēng)

ip_version

Integer

IP版本

【使用說(shuō)明】支持IPv4、IPv6

ipv6_address_mode

String

IPv6尋址模式

【使用說(shuō)明】?jī)H支持dhcpv6-stateful

ipv6_ra_mode

String

IPv6路由廣播模式

【使用說(shuō)明】?jī)H支持dhcpv6-stateful

network_id

String

所屬網(wǎng)絡(luò)的id

cidr

String

CIDR格式

【使用說(shuō)明】IPV4只支持10.0.0.0/8,172.16.0.0/12,192.168.0.0/16三個(gè)網(wǎng)段內(nèi)的地址,掩碼長(zhǎng)度不能大于28。

約束:當(dāng)ip_version=6時(shí),該字段不支持設(shè)置

gateway_ip

String

網(wǎng)關(guān)IP不允許和allocation_pools地址塊沖突。

【使用說(shuō)明】不支持修改。

allocation_pools

Array of allocation_pool objects

可用的IP池,allocation_pool對(duì)象參見(jiàn)表3

例如:[ { "start": "10.0.0.2", "end": "10.0.0.251"} ]

每個(gè)子網(wǎng)的第1個(gè)和最后3個(gè)IP地址為系統(tǒng)保留地址。以192.168.1.0/24為例,192.168.1.0、 192.168.1.253、192.168.1.254和192.168.1.255這些地址是系統(tǒng)保留地址。

[{"start": "2001:db8:a583:9::2", "end": "2001:db8:a583:9:ffff:ffff:ffff:fffc"}]

ipv6子網(wǎng)以2001:db8:a583:9::/64為例,2001:db8:a583:9::1和2001:db8:a583:9:ffff:ffff:ffff:fffd、2001:db8:a583:9:ffff:ffff:ffff:fffe、2001:db8:a583:9:ffff:ffff:ffff:ffff這些地址是系統(tǒng)保留地址。系統(tǒng)預(yù)留地址默認(rèn)不在allocation_pool范圍內(nèi)。

約束:更新時(shí)allocation_pool范圍不能包含網(wǎng)關(guān)和廣播地址的所有IP。

dns_nameservers

Array of strings

dns服務(wù)器

例如:"dns_nameservers": ["8.xx.xx.8","8.xx.xx.4"]

host_routes

Array of host_route objects

虛擬機(jī)靜態(tài)路由,參見(jiàn)“host_route對(duì)象”表

【使用說(shuō)明】不支持,忽略輸入信息

tenant_id

String

項(xiàng)目ID

enable_dhcp

Boolean

是否啟動(dòng)dhcp,false表示不提供dhcp服務(wù)的能力

【使用說(shuō)明】只支持true

subnetpool_id

String

子網(wǎng)池id

【使用說(shuō)明】目前IPv4不支持,IPv6支持

project_id

String

項(xiàng)目ID,請(qǐng)參見(jiàn)獲取項(xiàng)目ID。

created_at

String

資源創(chuàng)建時(shí)間,UTC時(shí)間

格式:yyyy-MM-ddTHH:mm:ss

updated_at

String

資源更新時(shí)間,UTC時(shí)間

格式:yyyy-MM-ddTHH:mm:ss

表3 allocation_pool對(duì)象

參數(shù)名

參數(shù)類(lèi)型

備注

start

String

網(wǎng)絡(luò)池起始IP

end

String

網(wǎng)絡(luò)池結(jié)束IP

表4 host_route對(duì)象

參數(shù)名

參數(shù)類(lèi)型

備注

destination

String

路由目的子網(wǎng)

nexthop

String

路由下一跳IP

響應(yīng)示例

{
    "subnet": {
        "name": "kesmdemeet",
        "cidr": "172.16.236.0/24",
        "id": "011fc878-5521-4654-a1ad-f5b0b5820302",
        "enable_dhcp": true,
        "network_id": "48efad0c-079d-4cc8-ace0-dce35d584124",
        "tenant_id": "bbfe8c41dd034a07bebd592bf03b4b0c",
        "project_id": "bbfe8c41dd034a07bebd592bf03b4b0c",
        "dns_nameservers": [],
        "allocation_pools": [
            {
                "start": "172.16.236.2",
                "end": "172.16.236.251"
            }
        ],
        "host_routes": [],
        "ip_version": 4,
        "gateway_ip": "172.16.236.1",
        "created_at": "2018-03-26T08:23:43",
        "updated_at": "2018-03-26T08:23:44"
    }
}

狀態(tài)碼

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

錯(cuò)誤碼

請(qǐng)參見(jiàn)錯(cuò)誤碼。