華為云計(jì)算 云知識(shí) 更新子網(wǎng)NeutronUpdateSubnet
更新子網(wǎng)NeutronUpdateSubnet

 

功能介紹

更新子網(wǎng)。

接口約束:

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

調(diào)試

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

URI

PUT /v2.0/subnets/{subnet_id}

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

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

參數(shù)名稱

類型

必選

說明

subnet

subnet object

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

更新操作時(shí)至少指定一項(xiàng)屬性

表2 subnet對(duì)象

屬性

是否必選

類型

說明

name

String

子網(wǎng)的名稱

allocation_pools

Array of allocation_pool objects

可用的IP池,allocation_pool對(duì)象參見表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)保留地址。系統(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"]

最大為5個(gè)

host_routes

Array of host_route objects

虛擬機(jī)靜態(tài)路由,參見表4

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

enable_dhcp

Boolean

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

【使用說明】只支持true

表3 allocation_pool對(duì)象

參數(shù)名

是否必選

參數(shù)類型

說明

start

String

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

end

String

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

表4 host_route對(duì)象

參數(shù)名

是否必選

參數(shù)類型

說明

destination

String

路由目的子網(wǎng)

nexthop

String

路由下一跳IP

請(qǐng)求示例

更新id為98bac90c-0ba7-4a63-8995-097da9bead1c的子網(wǎng),名稱更新為subnet-test。

PUT https://{Endpoint}/v2.0/subnets/98bac90c-0ba7-4a63-8995-097da9bead1c  
{
  "subnet": {
    "name": "subnet-test"
  }
}

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

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

參數(shù)名稱

類型

說明

subnet

subnet object

subnet對(duì)象,參見表6。

表6 subnet對(duì)象

屬性

類型

說明

id

String

子網(wǎng)的id

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

name

String

子網(wǎng)的名稱

ip_version

Integer

IP版本

【使用說明】支持IPv4、IPv6

ipv6_address_mode

String

IPv6尋址模式

【使用說明】僅支持dhcpv6-stateful

ipv6_ra_mode

String

IPv6路由廣播模式

【使用說明】僅支持dhcpv6-stateful

network_id

String

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

cidr

String

CIDR格式

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

IPV6掩碼長度不能大于128。

gateway_ip

String

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

【使用說明】不支持修改。

allocation_pools

Array of allocation_pool objects

可用的IP池,allocation_pool對(duì)象參見

表7

例如:[ { "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)路由,參見表8

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

tenant_id

String

項(xiàng)目ID

enable_dhcp

Boolean

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

【使用說明】只支持true

subnetpool_id

String

子網(wǎng)池id

【使用說明】目前IPv4不支持,IPv6支持

project_id

String

項(xiàng)目ID,請(qǐng)參見獲取項(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

表7 allocation_pool對(duì)象

參數(shù)名

參數(shù)類型

備注

start

String

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

end

String

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

表8 host_route對(duì)象

參數(shù)名

參數(shù)類型

備注

destination

String

路由目的子網(wǎng)

nexthop

String

路由下一跳IP

響應(yīng)示例

{
    "subnet": {
        "name": "subnet-test",
        "cidr": "172.16.2.0/24",
        "id": "98bac90c-0ba7-4a63-8995-097da9bead1c",
        "enable_dhcp": true,
        "network_id": "0133cd73-34d4-4d4c-bf1f-e65b24603206",
        "tenant_id": "bbfe8c41dd034a07bebd592bf03b4b0c",
        "project_id": "bbfe8c41dd034a07bebd592bf03b4b0c",
        "dns_nameservers": [],
        "allocation_pools": [
            {
                "start": "172.16.2.2",
                "end": "172.16.2.251"
            }
        ],
        "host_routes": [],
        "ip_version": 4,
        "gateway_ip": "172.16.2.1",
        "created_at": "2018-09-20T02:02:16",
        "updated_at": "2018-09-20T02:03:03"
    }
}

狀態(tài)碼

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

錯(cuò)誤碼

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