本頁說明如何在 Distributed Cloud connected 區域中,建立及管理 Google Distributed Cloud 子網路資源。
如要進一步瞭解 Distributed Cloud 子網路,請參閱「Distributed Cloud connected 的運作方式」。
請注意以下幾點:
- 每個 Distributed Cloud 區域最多可建立 138 個子網路。
- 子網路是父項網路中的 VLAN。因此,每個子網路都必須有全域不重複的 VLAN ID。Distributed Cloud Connected 不允許重複使用 VLAN ID。
- 如要讓 Distributed Cloud 連線隨機指派未使用的 VLAN ID,請在建立子網路時,將
0指定為 VLAN ID。 - Distributed Cloud 連線區域中的所有節點都能存取子網路。
建立子網路
如要建立 Distributed Cloud 子網路,請完成本節中的步驟。
如要完成這項工作,您必須在 Google Cloud 專案中擁有邊緣網路管理員角色 (roles/edgenetwork.admin)。
gcloud
使用 gcloud edge-cloud networking subnets create 指令:
gcloud edge-cloud networking subnets create SUBNETWORK_NAME \
--network=NETWORK_NAME \
--ipv4-range=IPV4_RANGE \
--vlan-id=VLAN_ID \
--location=REGION \
--zone=ZONE_NAME
更改下列內容:
SUBNETWORK_NAME:可清楚識別這個子網路的專屬名稱。NETWORK_NAME:封裝這個子網路的網路。IPV4_RANGE:這個子網路涵蓋的 IPv4 位址範圍,格式為 IP 位址/前置字元。VLAN_ID:此子網路的目標 VLAN ID。REGION:目標 Distributed Cloud 區域所屬的 Google Cloud 區域。ZONE_NAME:目標 Distributed Cloud 連結區域的名稱。
API
對 projects.locations.zones.subnets.create 方法發出 POST 要求:
POST /v1/projects/PROJECT_ID/locations/REGION/zones/ZONE_NAME/subnets?subnetId=SUBNETWORK_ID
{
"labels": { LABELS,
},
"network": { NETWORK_NAME,
},
"ipv4Cidr": { IPV4_RANGE,
},
"vlanId": { VLAN_ID,
},
}
更改下列內容:
PROJECT_ID:目標 Google Cloud 專案的 ID。REGION:目標 Distributed Cloud connected 區域所屬的 Google Cloud 區域。ZONE_NAME:目標 Distributed Cloud 連結區域的名稱。SUBNETWORK_ID:可專屬識別這個子網路的 ID。LABELS:要套用至這個子網路資源的標籤清單。NETWORK_NAME:封裝這個子網路的網路。IPV4_RANGE:這個子網路涵蓋的 IPv4 位址範圍,格式為 IP 位址/前置字元。VLAN_ID:此子網路的目標 VLAN ID。
列出子網路
如要列出 Distributed Cloud 連線區域中佈建的子網路,請完成本節中的步驟。
如要完成這項工作,您必須在專案中具備邊緣網路檢視者角色 (roles/edgenetwork.viewer)。 Google Cloud
gcloud
使用 gcloud edge-cloud networking subnets list 指令:
gcloud edge-cloud networking subnets list \
--location=REGION \
--zone=ZONE_NAME
更改下列內容:
REGION:目標 Distributed Cloud connected 區域所屬的 Google Cloud 區域。ZONE_NAME:目標 Distributed Cloud 連結區域的名稱。
API
對 projects.locations.zones.subnets.list 方法發出 GET 要求:
GET /v1/projects/PROJECT_ID/locations/REGION/zones/ZONE_NAME/subnets?filter=FILTER&pageSize=PAGE_SIZE&orderBy=SORT_BY&pageToken=PAGE_TOKEN
更改下列內容:
PROJECT_ID:目標 Google Cloud 專案的 ID。REGION:目標 Distributed Cloud connected 區域所屬的 Google Cloud 區域。ZONE_NAME:目標 Distributed Cloud 連結區域的名稱。FILTER:限制傳回結果為特定值的運算式。PAGE_SIZE:每頁要傳回的結果數。SORT_BY:以半形逗號分隔的欄位名稱清單,做為傳回結果的排序依據。預設排序順序為遞增;如要遞減排序,請在所需欄位前面加上~。PAGE_TOKEN:在回應的nextPageToken欄位中,對最後一個清單要求的回應中收到的權杖。傳送這個符記即可接收結果頁面。
取得子網路的相關資訊
如要取得 Distributed Cloud 子網路的相關資訊,請完成本節中的步驟。
如要完成這項工作,您必須在專案中具備邊緣網路檢視者角色 (roles/edgenetwork.viewer)。 Google Cloud
gcloud
使用 gcloud edge-cloud networking subnets describe 指令:
gcloud edge-cloud networking subnets describe SUBNETWORK_NAME \
--location=REGION \
--zone=ZONE_NAME
更改下列內容:
SUBNETWORK_NAME:目標子網路的名稱。REGION:目標 Distributed Cloud connected 區域所屬的 Google Cloud 區域。ZONE_NAME:目標 Distributed Cloud 連結區域的名稱。
API
對 projects.locations.zones.subnets.get 方法發出 GET 要求:
GET /v1/projects/PROJECT_ID/locations/REGION/zones/ZONE_NAME/subnets/SUBNETWORK_ID
更改下列內容:
PROJECT_ID:目標 Google Cloud 專案的 ID。REGION:目標 Distributed Cloud connected 區域所屬的 Google Cloud 區域。ZONE_NAME:目標 Distributed Cloud 連結區域的名稱。SUBNETWORK_NAME:目標子網路的名稱。
這項作業會傳回資源的詳細資訊,包括資源的佈建狀態:
PENDING:資源尚未開始佈建,也尚未在整個可用區中傳播。PROVISIONING:資源正在佈建中,您必須等待資源在整個可用區中傳播。RUNNING:資源已成功佈建並在整個區域中傳播,可供使用。FAILED:資源佈建失敗,資源尚未在整個區域中傳播。
刪除子網路
如要刪除 Distributed Cloud 子網路,請完成本節中的步驟。
如要完成這項工作,您必須在 Google Cloud 專案中擁有邊緣網路管理員角色 (roles/edgenetwork.admin)。
gcloud
使用 gcloud edge-cloud networking subnets delete 指令:
gcloud edge-cloud networking subnets delete SUBNETWORK_NAME \
--location=REGION \
--zone=ZONE_NAME
更改下列內容:
SUBNETWORK_NAME:目標子網路的名稱。REGION:目標 Distributed Cloud connected 區域所屬的 Google Cloud 區域。ZONE_NAME:目標 Distributed Cloud 連結區域的名稱。
API
對 projects.locations.zones.subnets.delete 方法發出 DELETE 要求:
DELETE /v1/projects/PROJECT_ID/locations/REGION/zones/ZONE_NAME/subnets/SUBNETWORK_ID
更改下列內容:
PROJECT_ID:目標 Google Cloud 專案的 ID。REGION:目標 Distributed Cloud connected 區域所屬的 Google Cloud 區域。ZONE_NAME:目標 Distributed Cloud 連結區域的名稱。SUBNETWORK_NAME:目標子網路的名稱。