本頁說明如何刪除路由器設備執行個體及其基礎Google Cloud 資源。為說明這個程序,本頁面會使用「建立路由器設備執行個體」一文所述的情境。
如要進一步瞭解路由器設備,請參閱「路由器設備總覽」。
如要進一步瞭解 Network Connectivity Center,請參閱 Network Connectivity Center 總覽。
事前準備
開始之前,請先詳閱下列各節。
建立或選取專案
為方便設定 Network Connectivity Center,請先找出有效的專案。
- Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
- 
    
    
      In the Google Cloud console, on the project selector page, select or create a Google Cloud project. Roles required to select or create a project - Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
- 
      Create a project: To create a project, you need the Project Creator
      (roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
 
- 
  
    Verify that billing is enabled for your Google Cloud project. 
- 
      Install the Google Cloud CLI. 
- 
          如果您使用外部識別資訊提供者 (IdP),請先 使用聯合身分登入 gcloud CLI。 
- 
        如要初始化 gcloud CLI,請執行下列指令: gcloud init
- 
    
    
      In the Google Cloud console, on the project selector page, select or create a Google Cloud project. Roles required to select or create a project - Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
- 
      Create a project: To create a project, you need the Project Creator
      (roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
 
- 
  
    Verify that billing is enabled for your Google Cloud project. 
- 
      Install the Google Cloud CLI. 
- 
          如果您使用外部識別資訊提供者 (IdP),請先 使用聯合身分登入 gcloud CLI。 
- 
        如要初始化 gcloud CLI,請執行下列指令: gcloud init
- 如果您使用 Google Cloud CLI,請使用 - gcloud config set指令設定專案 ID。- gcloud config set project PROJECT_ID - 將 - PROJECT_ID替換為專屬專案 ID。- 這個頁面的 gcloud CLI 指令假設您已設定專案 ID。 
- 如要確認專案 ID 設定正確無誤,請使用 - gcloud config list指令。- gcloud config list --format='text(core.project)' 
- NAME:要更新的 Cloud Router 名稱,例如- router-a
- PEER_NAME:要刪除的 BGP 對等互連名稱,例如- router-appliance-bgp-peer-0、- router-appliance-bgp-peer-1
- REGION:做為路由器設備執行個體的 VM 所在區域,例如- us-west1
- PROJECT_ID:Cloud Router 專案的 ID,例如- my-project
- PROJECT_ID:Cloud Router 專案的 ID,例如- my-project
- REGION:做為路由器設備執行個體的 VM 所在區域,例如- us-west1
- NAME:要更新的 Cloud Router 名稱,例如- router-a
- 同時刪除兩個介面。
- 只有在其他 Google Cloud資源未使用 Cloud Router 介面時,才能刪除這些介面。
- NAME:要更新的 Cloud Router 名稱,例如- router-a
- INTERFACE_NAME:介面名稱,例如- router-appliance-interface-0、- router-appliance-interface-1
- REGION:Cloud Router 所在的 Google Cloud 地區,例如- us-west1
- PROJECT_ID:Cloud Router 專案的 ID,例如- my-project
- PROJECT_ID:Cloud Router 專案的 ID,例如- my-project
- REGION:Cloud Router 所在的 Google Cloud 地區,例如- us-west1
- NAME:要更新的 Cloud Router 名稱,例如- router-a
- NETWORK:虛擬私有雲網路的名稱,例如- network-a
- INTERFACE_NAME:介面名稱,例如- router-appliance-interface-0、- router-appliance-interface-1
- INSTANCE_NAME:路由器設備執行個體的名稱,例如- router-app-a
- PROJECT_ID:Cloud Router 專案的 ID,例如- my-project
- ZONE:做為路由器設備執行個體的 VM 所在可用區,例如- us-west1-a
- PROJECT_ID:Cloud Router 專案的 ID,例如- my-project
- ZONE:做為路由器設備執行個體的 VM 所在可用區,例如- us-west1-a
- INSTANCE_NAME:路由器設備執行個體的名稱,例如- router-app-a
- 如要查看路由器設備的監控和記錄資訊,請參閱「查看記錄和指標」一文。
- 如要尋找 Router 設備問題的解決方案,請參閱「疑難排解」。
- 如要瞭解 API 和 gcloud指令的詳細資料,請參閱「API 和參考資料」。
取得存取權
如要使用 Network Connectivity Center,您需要存取權控管中說明的權限。
刪除 Cloud Router 上的 BGP 對等互連
gcloud
如要刪除路由器設備執行個體 Cloud Router 上兩個多餘的 BGP 對等互連,請輸入下列指令:
 gcloud compute routers remove-bgp-peer NAME \
     --peer-name PEER_NAME,PEER_NAME \
     --region=REGION \
     --project=PROJECT_ID
更改下列內容:
API
如要刪除路由器設備執行個體 Cloud Router 上的兩個 BGP 對等互連,請使用 compute.routers.patch 方法。在要求中,傳遞要保留的 BGP 對等互連資訊。你必須為每個對等互連項目加入所有已設定的欄位。
以下範例會從 Cloud Router 移除所有 BGP 對等互連:
PATCH
https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/region/REGION/routers/NAME
 {
  "bgpPeers": []
 }
更改下列內容:
刪除路由器設備執行個體的 Cloud Router 介面
刪除路由器設備執行個體的 Cloud Router 介面時,請遵守下列準則:
gcloud
如要刪除路由器設備執行個體的兩個備援 Cloud Router 介面,請輸入下列指令:
 gcloud compute routers remove-interface NAME \
     --interface-names=INTERFACE_NAME,INTERFACE_NAME \
     --region=REGION \
     --project=PROJECT_ID
更改下列內容:
API
如要刪除路由器設備執行個體 Cloud Router 上的兩個備援介面,請使用 compute.routers.patch 方法。在要求中,傳遞要保留的 BGP 對等互連資訊。你必須為每個對等互連項目加入所有已設定的欄位。
以下範例會從 Cloud Router 移除所有介面:
"PATCH   https"://www.googleapis.com/compute/v1/projects/PROJECT_ID/region/REGION/routers/NAME{
  "region":"REGION",
  "interfaces":[]
}
更改下列內容:
刪除 Cloud Router
如需相關步驟,請參閱刪除路由器。
刪除 Network Connectivity Center 輪輻
如需相關步驟,請參閱刪除 spoke。
刪除 VM 上的路由器設備軟體
如需相關步驟,請參閱路由器設備供應商的說明文件。
刪除路由器設備 VM
gcloud
如要刪除路由器設備 VM 執行個體,請輸入下列指令:
gcloud compute instances delete INSTANCE_NAME \
    --project=PROJECT_ID \
    --zone=ZONE
更改下列內容:
API
如要刪除 VM 執行個體,請使用 compute.instances.delete 方法:
DELETE https://www.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/INSTANCE_NAME
更改下列內容:
刪除允許 BGP 的防火牆規則
如適用,請刪除防火牆規則,該規則允許 TCP 通訊埠 179 上的 BGP 流量進入含有路由器設備執行個體的網路。
如需相關步驟,請參閱「刪除防火牆規則」。