本頁說明如何設定 NCC 閘道播送的路徑。每個 NCC 閘道通告的路由都會安裝在 NCC 中樞路由表的每個區域中,下一個躍點為 NCC 閘道輪輻。標準最佳路徑選取模式會決定每個 NCC 閘道通告路徑的優先順序。NCC 閘道 advertise 的路由會提供路徑,讓中樞其他輪輻中的資源用來將封包傳送至對應的 NCC 閘道。
在閘道輪輻中設定閘道 advertise 路由時,除非有有效的 SSE 閘道,否則這條路由不會傳播至 NCC 中樞路由表。
建立 NCC 閘道 advertise 路由
如要為從虛擬私有雲網路到 NCC 閘道的流量建立路徑,請執行下列操作。
控制台
前往 Google Cloud 控制台的「Network Connectivity Center」(網路連線中心) 頁面。
在專案選單中,選取要建立 Spoke 的專案。
按一下「Spokes」分頁標籤。
在「Spokes」頁面上,按一下要新增 NCC 閘道播送路徑的 Spoke。
在「Spoke details」(輪輻詳細資料) 頁面的「Routes advertised from NCC Gateway to hub」(從 NCC 閘道 advertise 至中樞的路由) 區段中,按一下「Add routes」(新增路由)。
在「Add routes」(新增路徑) 對話方塊中,執行下列操作:
- 在「Route name」(路徑名稱) 欄位中,輸入路徑名稱。
- 在「IP range」(IP 範圍) 欄位中,輸入 NCC 閘道通告路由的目的地 IP 位址範圍。
- 在「優先順序」欄位中,輸入通告路徑的優先順序。 預設值為 0。
如要新增更多路徑,請按一下「新增路徑」,然後輸入上一個步驟中的資訊。
點選「建立」。
gcloud
使用 gcloud network-connectivity spokes gateways advertised-routes create 指令:
gcloud 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.create 方法,並指定 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 閘道通告路徑中,唯一可變更的屬性是優先順序。如要變更通告路徑的優先順序,請按照下列步驟操作。
API
請使用 projects.locations.spokes.gatewayAdvertisedRoutes.patch 方法:
POST https://networkconnectivity.googleapis.com/v1beta/projects/PROJECT/locations/REGION/spokes/SPOKE_NAME/gatewayAdvertisedRoutes/ROUTE_NAME
{
"priority": PRIORITY
}
更改下列內容:
PROJECT:包含 NCC 閘道的專案 IDREGION:包含 NCC 閘道的區域SPOKE_NAME:閘道輪輻的名稱ROUTE_NAME:NCC 閘道播送的路由名稱PRIORITY:通告路徑的新優先順序
取得閘道 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 的路由清單,請按照下列步驟操作。
控制台
前往 Google Cloud 控制台的「Network Connectivity Center」(網路連線中心) 頁面。
在專案選單中,選取 Spoke 所在的專案。
在「Spoke name」(輪輻名稱) 欄中,按一下要查看閘道播送路徑的 NCC 閘道輪輻。
「輪輻詳細資料」頁面會列出「從 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:閘道輪輻的名稱
刪除閘道 advertise 路由
如要刪除 NCC 閘道 advertise 路由,請按照下列步驟操作。
控制台
前往 Google Cloud 控制台的「Network Connectivity Center」(網路連線中心) 頁面。
在專案選單中,選取要建立 Spoke 的專案。
按一下「Spokes」分頁標籤。
在「Spokes」頁面上,按一下要新增 NCC 閘道播送路徑的 Spoke。
在「Spoke details」(輪輻詳細資料) 頁面的「Routes advertised from NCC Gateway to hub」(從 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 閘道設定總覽」。
- 如要瞭解常見問題的解決方案,請參閱「排解 NCC 問題」。
- 如要瞭解 API 和 Google Cloud CLI 指令的詳細資料,請參閱「API 和參考資料」。