刪除路由器設備執行個體

本頁說明如何刪除路由器設備執行個體及其基礎Google Cloud 資源。為說明這個程序,本頁面會使用「建立路由器設備執行個體」一文所述的情境。

如要進一步瞭解路由器設備,請參閱「路由器設備總覽」。

如要進一步瞭解 Network Connectivity Center,請參閱 Network Connectivity Center 總覽

事前準備

開始設定前,請先詳閱下列各節。

建立或選取專案

為方便設定 Network Connectivity Center,請先找出有效的專案。

  1. 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.
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  3. Make sure that billing is enabled for your Google Cloud project.

  4. Install the Google Cloud CLI.

  5. If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.

  6. To initialize the gcloud CLI, run the following command:

    gcloud init
  7. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  8. Make sure that billing is enabled for your Google Cloud project.

  9. Install the Google Cloud CLI.

  10. If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.

  11. To initialize the gcloud CLI, run the following command:

    gcloud init
  12. 如果您使用 Google Cloud CLI,請使用 gcloud config set 指令設定專案 ID。

    gcloud config set project PROJECT_ID

    PROJECT_ID 替換為專屬專案 ID。

    這個頁面的 gcloud CLI 指令假設您已設定專案 ID。

  13. 如要確認專案 ID 設定正確無誤,請使用 gcloud config list 指令

    gcloud config list --format='text(core.project)'
  14. 取得存取權

    如要使用 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
    

    更改下列內容:

    • NAME:要更新的 Cloud Router 名稱,例如 router-a
    • PEER_NAME:要刪除的 BGP 對等互連名稱,例如 router-appliance-bgp-peer-0router-appliance-bgp-peer-1
    • REGION:做為路由器設備執行個體的 VM 所在區域,例如 us-west1
    • PROJECT_ID:Cloud Router 的專案 ID,例如 my-project

    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": []
     }
    

    更改下列內容:

    • PROJECT_ID:Cloud Router 的專案 ID,例如 my-project
    • REGION:做為路由器設備執行個體的 VM 所在區域,例如 us-west1
    • NAME:要更新的 Cloud Router 名稱,例如 router-a

    刪除路由器設備執行個體的 Cloud Router 介面

    刪除路由器設備執行個體的 Cloud Router 介面時,請遵循下列準則:

    • 同時刪除兩個介面。
    • 只有在其他 Google Cloud資源未使用 Cloud Router 介面時,才能刪除這些介面。

    gcloud

    如要刪除路由器設備執行個體的兩個備援 Cloud Router 介面,請輸入下列指令:

     gcloud compute routers remove-interface NAME \
         --interface-names=INTERFACE_NAME,INTERFACE_NAME \
         --region=REGION \
         --project=PROJECT_ID
    

    更改下列內容:

    • NAME:要更新的 Cloud Router 名稱,例如 router-a
    • INTERFACE_NAME:介面名稱,例如 router-appliance-interface-0router-appliance-interface-1
    • REGION:Cloud Router 所在的 Google Cloud 區域,例如 us-west1
    • PROJECT_ID:Cloud Router 的專案 ID,例如 my-project

    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":[]
    }
    

    更改下列內容:

    • 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-0router-appliance-interface-1

    刪除 Cloud Router

    如需相關步驟,請參閱刪除路由器

    刪除 Network Connectivity Center 輪輻

    如需相關步驟,請參閱刪除 spoke

    刪除 VM 上的路由器設備軟體

    如需相關步驟,請參閱路由器設備供應商的說明文件。

    刪除路由器設備 VM

    gcloud

    如要刪除路由器設備 VM 執行個體,請輸入下列指令:

    gcloud compute instances delete INSTANCE_NAME \
        --project=PROJECT_ID \
        --zone=ZONE
    

    更改下列內容:

    • INSTANCE_NAME:路由器設備執行個體的名稱,例如 router-app-a
    • PROJECT_ID:Cloud Router 的專案 ID,例如 my-project
    • ZONE:做為路由器設備執行個體的 VM 所在可用區,例如 us-west1-a

    API

    如要刪除 VM 執行個體,請使用 compute.instances.delete 方法

    DELETE https://www.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/INSTANCE_NAME
    

    更改下列內容:

    • PROJECT_ID:Cloud Router 的專案 ID,例如 my-project
    • ZONE:做為路由器設備執行個體的 VM 所在可用區,例如 us-west1-a
    • INSTANCE_NAME:路由器設備執行個體的名稱,例如 router-app-a

    刪除允許 BGP 的防火牆規則

    如適用,請刪除防火牆規則,該規則允許 TCP 通訊埠 179 上的 BGP 流量進入含有路由器設備執行個體的網路。

    如需相關步驟,請參閱「刪除防火牆規則」。

    後續步驟

    • 如要查看路由器設備的監控和記錄資訊,請參閱「查看記錄和指標」一文。
    • 如要尋找 Router 設備問題的解決方案,請參閱「疑難排解」。
    • 如要瞭解 API 和 gcloud 指令的詳細資料,請參閱「API 和參考資料」。