功能介紹
創(chuàng)建子網(wǎng)。
調(diào)試
您可以在API Explorer中調(diào)試該接口。
約束與限制
- 網(wǎng)絡(luò)下存在IPv4子網(wǎng)的情況下,才可以創(chuàng)建IPv6子網(wǎng)。
- VXLAN類型網(wǎng)絡(luò)下只能有一個IPv4的子網(wǎng)和一個IPv6的子網(wǎng)。
請求參數(shù)
|
名稱 |
是否必選 |
參數(shù)類型 |
說明 |
|---|---|---|---|
|
name |
是 |
String |
|
|
description |
否 |
String |
|
|
cidr |
是 |
String |
|
|
gateway_ip |
是 |
String |
|
|
ipv6_enable |
否 |
Boolean |
|
|
dhcp_enable |
否 |
Boolean |
|
|
primary_dns |
否 |
String |
內(nèi)網(wǎng) DNS地址 請參見華為云提供的內(nèi)網(wǎng)DNS地址是多少? 可以通過查詢名稱服務(wù)器列表查看DNS服務(wù)器的地址。 |
|
secondary_dns |
否 |
String |
內(nèi)網(wǎng)DNS地址請參見華為云提供的內(nèi)網(wǎng)DNS地址是多少? 可以通過查詢名稱服務(wù)器列表查看DNS服務(wù)器的地址。 |
|
dnsList |
否 |
Array of strings |
內(nèi)網(wǎng)DNS地址請參見華為云提供的內(nèi)網(wǎng)DNS地址是多少? 可以通過查詢名稱服務(wù)器列表查看DNS服務(wù)器的地址。 |
|
availability_zone |
否 |
String |
|
|
vpc_id |
是 |
String |
子網(wǎng)所在VPC標識 |
|
extra_dhcp_opts |
否 |
||
|
tags |
否 |
Array of Strings |
|
請求示例
- 創(chuàng)建一個子網(wǎng),所在vpc的id為3ec3b33f-ac1c-4630-ad1c-7dba1ed79d85,命名為subent,設(shè)置cidr為192.168.20.0/24,網(wǎng)關(guān)IP為192.168.20.1。
POST https://{Endpoint}/v1/{project_id}/subnets { "subnet": { "name": "subnet", "description": "", "cidr": "192.168.20.0/24", "gateway_ip": "192.168.20.1", "ipv6_enable": true, "dhcp_enable": true, "primary_dns": "114.xx.xx.114", "secondary_dns": "114.xx.xx.115", "dnsList": [ "114.xx.xx.114", "114.xx.xx.115" ], "availability_zone": "aa-bb-cc", "vpc_id": "3ec3b33f-ac1c-4630-ad1c-7dba1ed79d85", "extra_dhcp_opts": [ { "opt_value": "10.100.0.33,10.100.0.34", "opt_name": "ntp" }, { "opt_value": "24h", "opt_name": "addresstime" } ] } }
響應參數(shù)
|
名稱 |
參數(shù)類型 |
說明 |
|---|---|---|
|
id |
String |
uuid形式的一個資源標識 |
|
name |
String |
|
|
description |
String |
|
|
cidr |
String |
|
|
gateway_ip |
String |
|
|
ipv6_enable |
Boolean |
是否創(chuàng)建IPv6子網(wǎng) |
|
cidr_v6 |
String |
IPv6子網(wǎng)的網(wǎng)段,如果子網(wǎng)為IPv4子網(wǎng),則不返回此參數(shù) |
|
gateway_ip_v6 |
String |
IPv6子網(wǎng)的網(wǎng)關(guān),如果子網(wǎng)為IPv4子網(wǎng),則不返回此參數(shù) |
|
dhcp_enable |
Boolean |
子網(wǎng)是否開啟dhcp功能 |
|
primary_dns |
String |
|
|
secondary_dns |
String |
|
|
dnsList |
Array of strings |
|
|
availability_zone |
String |
|
|
vpc_id |
String |
子網(wǎng)所在VPC標識 |
|
status |
String |
|
|
neutron_network_id |
String |
對應網(wǎng)絡(luò)(OpenStack Neutron接口)id |
|
neutron_subnet_id |
String |
對應子網(wǎng)(OpenStack Neutron接口)id |
|
neutron_subnet_id_v6 |
String |
對應IPv6子網(wǎng)(OpenStack Neutron接口)id,如果子網(wǎng)為IPv4子網(wǎng),則不返回此參數(shù) |
|
extra_dhcp_opts |
||
|
scope |
String |
子網(wǎng)作用域。 取值范圍:
|
|
tenant_id |
String |
功能說明:項目ID。 |
|
created_at |
String |
|
|
updated_at |
String |
|
響應示例
{
"subnet": {
"id": "4779ab1c-7c1a-44b1-a02e-93dfc361b32d",
"name": "subnet",
"description": "",
"cidr": "192.168.20.0/24",
"dnsList": [
"114.xx.xx.114",
"114.xx.xx.115"
],
"status": "UNKNOWN",
"vpc_id": "3ec3b33f-ac1c-4630-ad1c-7dba1ed79d85",
"gateway_ip": "192.168.20.1",
"ipv6_enable": true,
"cidr_v6": "2001:db8:a583::/64",
"gateway_ip_v6": "2001:db8:a583::1",
"dhcp_enable": true,
"primary_dns": "114.xx.xx.114",
"secondary_dns": "114.xx.xx.115",
"availability_zone": "aa-bb-cc",
"neutron_network_id": "4779ab1c-7c1a-44b1-a02e-93dfc361b32d",
"neutron_subnet_id": "213cb9d-3122-2ac1-1a29-91ffc1231a12",
"neutron_subnet_id_v6": "e0fa7de1-a6e2-44c9-b052-b9d8cebe93c4",
"extra_dhcp_opts": [
{
"opt_value": "10.100.0.33,10.100.0.34",
"opt_name": "ntp"
},
{
"opt_value": "24h",
"opt_name": "addresstime"
}
],
"tenant_id": "087679f0aa80d32a2f4ec0172f5e902b",
"created_at": "2022-12-15T02:42:07",
"updated_at": "2022-12-15T02:42:07"
}
}
狀態(tài)碼
請參見狀態(tài)碼。
錯誤碼
請參考錯誤碼。
最新文章
- VPC網(wǎng)絡(luò)ACL_如何防護VPC子網(wǎng)安全_子網(wǎng)防火墻-華為云
- 如何規(guī)劃VPC數(shù)量_如何規(guī)劃VPC子網(wǎng)_如何規(guī)劃VPC路由策略
- 如何創(chuàng)建網(wǎng)站
- ModelArts模型訓練_創(chuàng)建訓練作業(yè)_如何創(chuàng)建訓練作業(yè)
- 容器鏡像創(chuàng)建用戶并授權(quán)使用SWR_華為云SWR_容器鏡像創(chuàng)建授權(quán)
- 如何使用模板創(chuàng)建函數(shù)_模板創(chuàng)建函數(shù)_函數(shù)工作流 FunctionGraph-華為云
