本頁說明如何設定 NCC 閘道播送的路徑。每個 NCC 閘道 advertise 的路由都會安裝在 Network Connectivity Center 中樞的路徑表中,NCC 閘道輪輻會連線至該中樞。NCC 閘道本身是其放送的每個路由的下一個躍點。NCC 閘道公告路徑的優先順序遵循標準最佳路徑選取模式。
NCC 閘道 advertise 的路由會提供路徑,讓中樞其他輪輻中的資源可用於將封包傳送至對應的 NCC 閘道。
建立 NCC 閘道 advertise 路由
如要建立路徑,將虛擬私有雲網路的流量導向 NCC 閘道,請按照下列步驟操作:
gcloud
使用 gcloud beta network-connectivity spokes gateways advertised-routes create 指令:
gcloud beta network-connectivity spokes gateways advertised-routes create ROUTE_NAME \
--region=REGION \
--project=PROJECT \
--spoke=SPOKE_NAME \
--ip-range=IP_RANGE \
--priority=PRIORITY \
--advertise-to-hub
更改下列內容:
ROUTE_NAME:您要建立的 NCC 閘道播送路由名稱REGION:包含 NCC 閘道的區域PROJECT:包含 NCC 閘道的專案 IDSPOKE_NAME:閘道輪輻的名稱IP_RANGE:NCC 閘道宣傳路由的目的地 IP 位址範圍。PRIORITY:通告路徑的優先順序。預設值為 0
API
使用 projects.locations.spokes.gatewayAdvertisedRoutes 方法,並指定 IP 位址範圍和優先順序:
POST https://networkconnectivity.googleapis.com/v1beta/projects/PROJECT/locations/REGION/spokes/SPOKE_NAME/gatewayAdvertisedRoutes
{
"ip_range": "IP_RANGE",
"priority": "PRIORITY",
"recipient": "ADVERTISE_TO_HUB",
}
更改下列內容:
PROJECT:包含 NCC 閘道的專案 IDREGION:包含 NCC 閘道的區域SPOKE_NAME:閘道輪輻的名稱IP_RANGE:NCC 閘道宣傳路由的目的地 IP 位址範圍。PRIORITY:通告路徑的優先順序。預設值為 0
取得閘道 advertise 路由的詳細資料
如要取得 NCC 閘道 advertise 路由的詳細資料,請按照下列步驟操作:
gcloud
使用 gcloud beta network-connectivity spokes gateways advertised-routes describe 指令:
gcloud beta network-connectivity spokes gateways advertised-routes describe ROUTE_NAME \
--region=REGION \
--project=PROJECT \
--spoke=SPOKE_NAME
更改下列內容:
ROUTE_NAME:NCC 閘道播送路由的名稱REGION:包含 NCC 閘道的區域PROJECT:包含 NCC 閘道的專案 IDSPOKE_NAME:閘道輪輻的名稱
API
使用 projects.locations.spokes.gatewayAdvertisedRoutes.get 方法,並將要求主體留空:
GET https://networkconnectivity.googleapis.com/v1beta/projects/PROJECT/regions/REGION/spokes/SPOKE_NAME/gatewayAdvertisedRoutes/ROUTE_NAME
更改下列內容:
PROJECT:包含 NCC 閘道的專案 IDREGION:包含 NCC 閘道的區域SPOKE_NAME:閘道輪輻的名稱ROUTE_NAME:NCC 閘道播送路由的名稱
查看閘道 advertise 路由清單
如要查看 NCC 閘道 advertise 的路由清單,請按照下列步驟操作。
gcloud
使用 gcloud beta network-connectivity spokes gateways advertised-routes list 指令:
gcloud beta network-connectivity spokes gateways advertised-routes list \
--region=REGION \
--project=PROJECT \
--spoke=SPOKE_NAME
更改下列內容:
REGION:包含 NCC 閘道的區域PROJECT:包含 NCC 閘道的專案 IDSPOKE_NAME:閘道輪輻的名稱
API
使用 projects.locations.spokes.gatewayAdvertisedRoutes.list 方法,並將要求主體留空:
LIST https://networkconnectivity.googleapis.com/v1beta/projects/PROJECT/regions/REGION/spokes/SPOKE_NAME/gatewayAdvertisedRoutes
更改下列內容:
PROJECT:包含 NCC 閘道的專案 IDREGION:包含 NCC 閘道的區域SPOKE_NAME:閘道輪輻的名稱
刪除通告路徑
如要刪除 NCC 閘道 advertise 路由,請按照下列步驟操作:
gcloud
使用 gcloud beta network-connectivity spokes gateways advertised-routes delete 指令:
gcloud beta network-connectivity spokes gateways advertised-routes delete ROUTE_NAME \ --region=REGION \ --project=PROJECT \ --spoke=SPOKE_NAME
更改下列內容:
ROUTE_NAME:您要刪除的 NCC 閘道播送路由名稱REGION:包含 NCC 閘道的區域PROJECT:包含 NCC 閘道的專案 IDSPOKE_NAME:閘道輪輻的名稱
API
使用 projects.locations.spokes.gatewayAdvertisedRoutes.delete 方法,並將要求主體留空:
DELETE https://networkconnectivity.googleapis.com/v1beta/projects/PROJECT/regions/REGION/spokes/SPOKE_NAME/gatewayAdvertisedRoutes/ROUTE_NAME
更改下列內容:
PROJECT:包含 NCC 閘道的專案 IDREGION:包含 NCC 閘道的區域SPOKE_NAME:閘道輪輻的名稱ROUTE_NAME:您要刪除的 NCC 閘道播送路由名稱
後續步驟
- 如要瞭解 NCC 閘道,請參閱 NCC 閘道總覽。
- 如要瞭解如何設定 NCC 閘道,請參閱「NCC 閘道設定總覽」。
- 如要瞭解常見問題的解決方案,請參閱「排解 Network Connectivity Center 問題」。
- 如要瞭解 API 和 Google Cloud CLI 指令的詳細資料,請參閱「API 和參考資料」。