在網路中設定網址篩選服務

網址篩選服務可讓您使用輸出 HTTP 或 HTTPS 訊息中的網域和伺服器名稱指示 (SNI) 資訊,篩選 Google Cloud 工作負載流量。這項服務會封鎖與惡意網址清單的通訊,保護網路免於威脅。如要在網路上啟用這項服務,您必須設定多個 Cloud Next Generation Firewall 元件。本教學課程說明在網路中設定網址篩選服務的端對端工作流程。

目標

本教學課程將說明如何完成下列工作:

  • 建立包含兩個子網路的虛擬私有雲 (VPC) 網路。
  • 在虛擬私有雲網路的第一個子網路中建立伺服器虛擬機器 (VM) 執行個體,並在 VM 上安裝 Apache 伺服器。
  • 在虛擬私有雲網路的第二個子網路中建立用戶端 VM 執行個體。
  • 建立網址篩選安全性設定檔和安全性設定檔群組。
  • 建立防火牆端點,並與虛擬私有雲網路建立關聯。
  • 新增全域網路防火牆政策,並加入下列防火牆規則:
    • 防火牆規則,可讓 Identity-Aware Proxy (IAP) 存取虛擬私有雲網路中的 VM 執行個體。
    • 防火牆規則,可將所有輸出流量導向第 7 層檢查。
  • 確認是否允許連往伺服器 VM 執行個體的流量。
  • 清除資源。

下圖顯示本教學課程中部署設定的大致架構。虛擬私有雲 fw-policy-urlf vpc-urlf 上的防火牆政策會將所有輸出流量重新導向至可用區 asia-southeast1-a 中的防火牆端點 endpoint-urlf。端點會檢查輸出 HTTP 或 HTTPS 訊息中的網域和 SNI 資訊,比對網址篩選安全性設定檔 sec-profile-urlf 中列出的網址。如果端點找到相符項目,就會允許流量;否則會拒絕。

自訂虛擬私有雲網路中的網址篩選服務,防止與惡意網址通訊。
自訂虛擬私有雲網路中的網址篩選服務 (按一下即可放大)。

費用

建立防火牆端點會產生費用。如需定價詳情,請參閱「Cloud Next Generation Firewall 定價」。

事前準備

  1. 登入 Google Cloud 帳戶。如果您是 Google Cloud新手,歡迎 建立帳戶,親自評估產品在實際工作環境中的成效。新客戶還能獲得價值 $300 美元的免費抵免額,可用於執行、測試及部署工作負載。
  2. 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 role (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  3. Verify that billing is enabled for your Google Cloud project.

  4. 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 role (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  5. Verify that billing is enabled for your Google Cloud project.

  6. 為專案啟用 Compute Engine API
  7. 為專案啟用 Network Security API
  8. 為專案啟用 Identity-Aware Proxy API
  9. 在機構中具備 Compute 網路管理員 (roles/compute.networkAdmin) IAM 角色。
  10. 如果您希望透過指令列操作,請先安裝 Google Cloud CLI。如需該工具的概念與安裝資訊,請參閱 gcloud CLI 總覽

    注意:如果您先前沒有執行過 gcloud CLI,請先執行 gcloud init,將 gcloud CLI 目錄初始化。

建立含子網路的自訂虛擬私有雲網路

在本節中,您會建立含兩個 IPv4 子網路的自訂模式 VPC 網路。

控制台

  1. 前往 Google Cloud 控制台的「VPC Networks」(虛擬私有雲網路) 頁面。

    前往「VPC networks」(虛擬私有雲網路)

  2. 按一下「建立虛擬私有雲網路」

  3. 在「Name」(名稱) 中輸入 vpc-urlf

  4. 在「說明」中輸入 VPC network to set up URL filtering service

  5. 在「子網路建立模式」部分,選取「自訂」

  6. 在「New subnet」(新子網路) 部分,指定子網路的以下設定參數:

    • Name (名稱):subnet-server-urlf
    • Region (區域):asia-southeast1
    • IPv4 範圍10.0.0.0/24
  7. 按一下 [完成]

  8. 按一下「Add subnet」(新增子網路),然後指定下列設定參數:

    • Name (名稱):subnet-client-urlf
    • Region (區域):us-central1
    • IPv4 範圍192.168.10.0/24
  9. 按一下 [完成]

  10. 點選「建立」

gcloud

  1. 如要建立 VPC 網路,請執行下列指令:

    gcloud compute networks create vpc-urlf \
      --subnet-mode custom \
      --description "VPC network to set up URL filtering service."
    
  2. 在「授權 Cloud Shell」對話方塊中,按一下「授權」

  3. 如要建立子網路,請執行下列指令:

    gcloud compute networks subnets create subnet-server-urlf \
      --network vpc-urlf \
      --region asia-southeast1 \
      --range 10.0.0.0/24
    
  4. 如要建立另一個子網路,請執行下列指令:

    gcloud compute networks subnets create subnet-client-urlf \
      --network vpc-urlf \
      --region us-central1 \
      --range 192.168.10.0/24
    

建立 Cloud Router 和 Cloud NAT 閘道

在下一節中建立沒有公開 IPv4 位址的用戶端和伺服器 Linux VM 執行個體之前,您必須先建立 Cloud Router 和 Cloud NAT 閘道,讓這些 VM 存取公用網際網路。

控制台

  1. 前往 Google Cloud 控制台的「Cloud NAT」頁面。

    前往 Cloud NAT

  2. 按一下「開始使用」或「建立 Cloud NAT 閘道」

  3. 在「閘道名稱」中輸入 gateway-urlf

  4. 在「NAT type」(NAT 類型) 中,選取「Public」(公開)

  5. 在「Select Cloud Router」部分,指定下列設定參數:

    • 「Network」(網路)vpc-urlf
    • 區域asia-southeast1
    • Cloud Router建立新的路由器
      1. 在「Name」(名稱) 中輸入 router-urlf
      2. 點選「建立」
  6. 點選「建立」

gcloud

  1. 如要建立 Cloud Router,請執行下列指令:

    gcloud compute routers create router-urlf \
      --network=vpc-urlf \
      --region=asia-southeast1
    
  2. 如要建立 Cloud NAT 閘道,請執行下列指令:

    gcloud compute routers nats create gateway-urlf \
      --router=router-urlf \
      --region=asia-southeast1 \
      --auto-allocate-nat-external-ips \
      --nat-all-subnet-ip-ranges
    

建立 VM 執行個體

在本節中,您將建立伺服器和用戶端 VM 執行個體。如要查看建立 VM 執行個體所需的權限和角色,請參閱「必要的角色」。

建立伺服器 VM 執行個體

在本節中,您會在子網路 subnet-server-urlf 中建立 VM 執行個體,並在該執行個體上安裝 Apache 伺服器。

控制台

  1. 前往 Google Cloud 控制台的「Create an instance」(建立執行個體) 頁面。

    前往「建立執行個體」

  2. 在「機器設定」窗格中,執行下列操作:

    1. 在「Name」(名稱) 中輸入 vm-server-urlf
    2. 在「Region」(區域) 中選取 asia-southeast1 (Singapore)
    3. 在「Zone」(可用區) 中選取 asia-southeast1-a
  3. 在導覽選單中,按一下「OS and Storage」(OS 和儲存空間)

    在「Operating system and storage」(作業系統和儲存空間) 專區中,確認「映像檔」為「Debian GNU/Linux 12 (bookworm)」。如果不是,請按一下「變更」,然後將「作業系統」欄位設為「Debian」,並將「版本」欄位設為「Debian GNU/Linux 12 (bookworm)」

  4. 在導覽選單中,按一下「Networking」(網路)

    1. 在「網路介面」部分,指定下列設定參數:
      • 「Network」(網路)vpc-urlf
      • 「Subnetwork」(子網路)subnet-server-urlf IPv4 (10.0.0.0/24)
      • 外部 IPv4 位址None
    2. 按一下 [完成]
  5. 在導覽選單中,按一下「進階」,並在「自動化」專區的「開機指令碼」欄位中輸入下列指令碼:

      #! /bin/bash
      apt update
      apt -y install apache2
      cat <<EOF > /var/www/html/index.html
      <html><body><p>Hello world.</p></body></html>
      EOF
    
  6. 點選「建立」

gcloud

如要建立伺服器 VM,請執行下列指令:

gcloud compute instances create vm-server-urlf \
    --network vpc-urlf \
    --zone asia-southeast1-a \
    --network-interface=stack-type=IPV4_ONLY,subnet=subnet-server-urlf,no-address \
    --image-project debian-cloud \
    --image-family debian-12 \
    --metadata=startup-script='#! /bin/bash
     apt update
     apt -y install apache2
     cat <<EOF > /var/www/html/index.html
     <html><body><p>Hello World.</p></body></html>
     EOF'

如要為伺服器 VM 使用網域網址,請按照下列步驟操作:

建立用戶端 VM 執行個體

在本節中,您會在子網路 subnet-client-urlf 中建立 VM 執行個體。

控制台

  1. 前往 Google Cloud 控制台的「Create an instance」(建立執行個體) 頁面。

    前往「建立執行個體」

  2. 在「機器設定」窗格中,執行下列操作:

    1. 在「Name」(名稱) 中輸入 vm-client-urlf
    2. 在「Region」(區域) 中選取 us-central1 (Iowa)
    3. 在「Zone」(可用區) 中選取 us-central1-a
  3. 在導覽選單中,按一下「Networking」(網路)

    1. 在「網路介面」部分,指定下列設定參數:
      • 「Network」(網路)vpc-urlf
      • 「Subnetwork」(子網路)subnet-client-urlf IPv4 (192.168.10.0/24)
      • 外部 IPv4 位址None
    2. 按一下 [完成]
  4. 點選「建立」

gcloud

如要建立用戶端 VM,請執行下列指令:

gcloud compute instances create vm-client-urlf \
    --network vpc-urlf \
    --zone us-central1-a \
    --network-interface=stack-type=IPV4_ONLY,subnet=subnet-client-urlf,no-address \

建立網址篩選安全性設定檔

在本節中,您將在貴機構中建立 url-filtering 類型的安全性設定檔。如要查看建立網址篩選安全性設定檔所需的權限和角色,請參閱「建立網址篩選安全性設定檔」。

控制台

  1. 前往 Google Cloud 控制台的「Security profiles」(安全性設定檔) 頁面。

    前往「安全性設定檔」

  2. 在專案選取器選單中,選取您的機構。

  3. 選取「安全性設定檔」分頁標籤。

  4. 按一下 Create profile

  5. 在「Name」(名稱) 中輸入 sec-profile-urlf

  6. 在「說明」中輸入 Security profile to set up URL filtering service

  7. 在「Purpose」(用途) 部分中,選取「Cloud NGFW Enterprise」(Cloud NGFW Enterprise),指定要建立與防火牆相關聯的安全設定檔。

  8. 在「類型」部分,選取「網址篩選」,指定要建立 url-filtering 類型的安全性設定檔。

  9. 在「網址篩選器」部分,按一下「建立網址篩選器」按鈕,即可建立新的網址篩選器。在「建立網址篩選器」窗格中,指定下列詳細資料:

    • 優先順序:指定網址篩選器的優先順序。例如:1000
    • 動作:指定「允許」,允許流量流向伺服器 VM 執行個體。
    • 網址清單:指定伺服器 VM 執行個體的網域網址。例如:www.example.com
  10. 點選「建立」

gcloud

建立 YAML 檔案,並填入下列安全性設定檔內容:

name: sec-profile-urlf
type: url-filtering
urlFilteringProfile:
  urlFilters:
    - filteringAction: ALLOW
      priority: 1000
      urls: URL

如要使用 YAML 檔案建立安全性設定檔,請執行下列指令:

gcloud network-security security-profiles import sec-profile-urlf \
    --location global \
    --source FILE_NAME \
    --organization ORGANIZATION_ID \

更改下列內容:

  • URL:伺服器 VM 執行個體的網域網址。例如:www.example.com
  • FILE_NAME:您建立的 YAML 檔案名稱。
  • ORGANIZATION_ID:建立安全設定檔的機構。

建立安全性設定檔群組

在本節中,您將建立安全性設定檔群組,納入上一節建立的網址篩選安全性設定檔。如要查看建立安全性設定檔群組所需的權限和角色,請參閱「建立安全性設定檔群組」。

控制台

  1. 前往 Google Cloud 控制台的「Security profiles」(安全性設定檔) 頁面。

    前往「安全性設定檔」

  2. 在專案選取器選單中,選取您的機構。

  3. 選取「安全性設定檔群組」分頁標籤。

  4. 按一下「建立設定檔群組」

  5. 在「Name」(名稱) 中輸入 sec-profile-group-urlf

  6. 在「說明」中輸入 Security profile group to set up URL filtering service

  7. 如要為 Cloud Next Generation Firewall Enterprise 建立安全性設定檔群組,請在「用途」部分選取「Cloud NGFW Enterprise」

  8. 在「網址篩選設定檔」清單中,選取「sec-profile-urlf」。

  9. 點選「建立」

gcloud

如要建立安全性設定檔群組,請執行下列指令:

gcloud network-security security-profile-groups \
    create sec-profile-group-urlf \
    --organization ORGANIZATION_ID \
    --location global \
    --project PROJECT_ID \
    --url-filtering-profile  \
    organizations/ORGANIZATION_ID/locations/global/securityProfiles/sec-profile-urlf \
    --description "Security profile group to set up URL filtering service."

更改下列內容:

  • ORGANIZATION_ID:建立安全設定檔群組的機構。
  • PROJECT_ID:用於安全設定檔群組的配額和存取限制的專案 ID。

建立防火牆端點

在本節中,您將在特定區域建立防火牆端點。如要查看建立防火牆端點所需的權限和角色,請參閱「建立防火牆端點」。

注意:建立防火牆端點時,防火牆端點的狀態會設為 Creating。防火牆端點就緒後,狀態會變更為 Active。您可以查看端點,確認端點狀態。

控制台

  1. 前往 Google Cloud 控制台的「Firewall endpoints」(防火牆端點) 頁面。

    前往「防火牆端點」

  2. 在專案選取器選單中,選取您的機構。

  3. 點選「建立」

  4. 在「Region」(區域) 清單中選取「asia-southeast1 (Singapore)」。

  5. 在「Zone」(可用區) 清單中選取「asia-southeast1-a」。

  6. 在「Name」(名稱) 中輸入 endpoint-urlf

  7. 在「報帳專案」清單中,選取要用於防火牆端點帳單的專案 Google Cloud ,然後按一下「繼續」

  8. 點選「建立」

gcloud

如要建立防火牆端點,請執行下列指令:

gcloud network-security firewall-endpoints \
    create endpoint-urlf \
    --organization ORGANIZATION_ID \
    --zone asia-southeast1-a \
    --billing-project PROJECT_ID

更改下列內容:

  • ORGANIZATION_ID:建立防火牆端點的機構。
  • PROJECT_ID:用於防火牆端點帳單的專案 ID。

建立防火牆端點關聯

在本節中,您會將防火牆端點與先前建立的虛擬私有雲網路建立關聯。如要查看建立防火牆端點關聯所需的權限和角色,請參閱「建立防火牆端點關聯」。

注意:建立防火牆端點關聯時,其狀態會設為 Creating。防火牆端點關聯準備就緒後,狀態會變更為 Active。您可以查看端點關聯,確認端點狀態。

控制台

  1. 前往 Google Cloud 控制台的「VPC Networks」(虛擬私有雲網路) 頁面。

    前往「VPC networks」(虛擬私有雲網路)

  2. 按一下 vpc-urlf 網路,顯示其「虛擬私有雲網路詳細資料」頁面。

  3. 選取「防火牆端點」分頁標籤。

  4. 按一下「建立端點關聯」

  5. 在「Region」(區域) 清單中選取「asia-southeast1」。

  6. 在「Zone」(可用區) 清單中選取「asia-southeast1-a」。

  7. 在「Firewall endpoint」(防火牆端點) 清單中,選取「endpoint-urlf

  8. 點選「建立」

gcloud

如要建立防火牆端點關聯,請執行下列指令:

gcloud network-security firewall-endpoint-associations \
    create endpoint-association-urlf \
    --endpoint  organizations/ORGANIZATION_ID/locations/asia-southeast1-a/firewallEndpoints/endpoint-urlf \
    --network vpc-urlf \
    --zone asia-southeast1-a \
    --project PROJECT_ID

更改下列內容:

  • ORGANIZATION_ID:建立防火牆端點的機構。
  • PROJECT_ID:建立關聯的專案 ID。

建立全域網路防火牆政策

在本節中,您將建立全域網路防火牆政策,其中包含下列兩項防火牆規則:

  1. 優先順序為 100 的輸入防火牆規則,允許 TCP 流量傳輸至通訊埠 22。這項規則可讓 IAP 存取虛擬私有雲網路中的 VM 執行個體。
  2. 優先順序為 200 的輸出防火牆規則,可對特定可用區中伺服器 VM 的輸出流量執行第 7 層檢查。

如要查看建立全域網路防火牆政策及其規則所需的權限和角色,請參閱「建立全域網路防火牆政策」、「為 VM 目標建立輸入規則」和「為 VM 目標建立輸出規則」。

控制台

  1. 前往 Google Cloud 控制台的「Firewall policies」(防火牆政策) 頁面。

    前往「Firewall policies」(防火牆政策)

  2. 在專案選取器清單中,選取機構內的專案。

  3. 按一下「建立防火牆政策」

  4. 在「Policy Name」(政策名稱) 中輸入 fw-policy-urlf

  5. 在「政策類型」部分,選取「虛擬私有雲政策」。

  6. 在「Deployment scope」(部署範圍) 部分,選取「Global」(全域)

  7. 依序點選「繼續」和「建立防火牆規則」

  8. 在「Priority」(優先順序) 欄位中輸入 100

  9. 在「Direction of traffic」(流量方向) 中選取 [Ingress] (輸入)

  10. 在「Action on match」(相符時執行的動作) 中選取 [Allow] (允許)

  11. 在「記錄」部分選取「已啟用」

  12. 在「來源」篩選器中選取「IPv4」,然後在「IP 範圍」欄位中輸入 35.235.240.0/20

  13. 在「Protocols and ports」(通訊協定和通訊埠) 部分,選取「Specified protocols and ports」(指定的通訊協定和通訊埠)

  14. 選取「TCP」,然後在「Ports」中輸入 22

  15. 點選「建立」

  16. 點按「建立防火牆規則」

  17. 在「Priority」(優先順序) 欄位中輸入 200

  18. 在「Direction of traffic」(流量方向) 中選取「Egress」(輸出)

  19. 在「相符時執行的動作」中,選取「套用安全性設定檔群組」

  20. 在「Security profile group」(安全性設定檔群組) 清單中,選取「sec-profile-group-urlf

  21. 在「記錄」部分選取「已啟用」

  22. 在「目的地」篩選器中選取「IPv4」,然後在「IP 範圍」欄位中輸入 0.0.0.0/0

  23. 在「Protocols and ports」(通訊協定和通訊埠) 部分,選取「Specified protocols and ports」(指定的通訊協定和通訊埠)

  24. 選取「TCP」,然後在「Ports」中輸入 80, 443

  25. 點選「建立」

  26. 按一下「繼續」,前往「新增鏡像規則」部分。

  27. 再次按一下「繼續」,開啟「將政策與聯播網建立關聯」部分。

  28. 選取 vpc-urlf 網路。

  29. 按一下「關聯」

  30. 點選「建立」

gcloud

  1. 如要建立全域網路防火牆政策,請執行下列指令:

    gcloud compute network-firewall-policies \
      create fw-policy-urlf \
      --global \
      --project PROJECT_ID
    

    更改下列內容:

    • PROJECT_ID:建立全域網路防火牆政策的專案 ID。
  2. 如要新增防火牆規則來啟用 IAP 存取權,請執行下列指令:

    gcloud compute network-firewall-policies rules create 100 \
      --firewall-policy fw-policy-urlf \
      --direction INGRESS \
      --action ALLOW \
      --src-ip-ranges 35.235.240.0/20 \
      --layer4-configs tcp:22 \
      --global-firewall-policy \
      --enable-logging
    
  3. 如要新增防火牆規則,啟用網址篩選的第 7 層檢查,請執行下列指令:

    gcloud compute network-firewall-policies rules create 200 \
      --direction EGRESS \
      --firewall-policy fw-policy-urlf \
      --action apply_security_profile_group \
      --dest-ip-ranges 0.0.0.0/0 \
      --layer4-configs tcp:80, tcp:443 \
      --global-firewall-policy \
      --security-profile-group \
      //networksecurity.googleapis.com/organizations/ORGANIZATION_ID \
      /locations/global/securityProfileGroups/sec-profile-group-urlf \
      --enable-logging
    

    更改下列內容:

    • ORGANIZATION_ID:建立安全設定檔群組的機構。
  4. 如要將防火牆政策與虛擬私有雲網路建立關聯,請執行下列指令:

    gcloud compute network-firewall-policies associations create \
     --firewall-policy fw-policy-urlf \
     --network vpc-urlf \
     --name fw-pol-association-urlf \
     --global-firewall-policy \
     --project PROJECT_ID
    

    更改下列內容:

    • PROJECT_ID:建立 VPC 關聯的專案 ID。

測試設定

在本節中,您將產生流量,並由端點攔截,然後套用全域網路防火牆政策,執行第 7 層檢查,藉此測試設定。

控制台

  1. 前往 Google Cloud 控制台的「VM instances」(VM 執行個體) 頁面

    前往 VM 執行個體

  2. vm-client-urlf VM 的「連線」欄中,按一下「SSH」

  3. 在「SSH-in-browser」(直接透過瀏覽器進行 SSH 連線) 對話方塊中,按一下「Authorize」(授權),然後等待連線建立。

  4. 如要確認是否允許對伺服器 VM 執行個體提出要求,請執行下列指令:

    curl URL -m 2
    

    URL 替換為 vm-server-urlf 伺服器 VM 執行個體的網域網址。例如:www.example.com

    由於網址篩選器 (優先順序 1000) 允許封包,因此要求成功。

  5. 關閉「透過瀏覽器建立 SSH 連線」對話方塊。

gcloud

  1. 如要連線至 vm-client-urlf VM,請執行下列指令:

    gcloud compute ssh vm-client-urlf \
       --zone=us-central1-a \
       --tunnel-through-iap
    

    系統提示時,請按下 Y 確認,然後按下 Enter 鍵。

  2. 如要確認是否允許對伺服器 VM 執行個體提出要求,請執行下列指令:

    curl URL -m 2
    

    URL 替換為 vm-server-urlf 伺服器 VM 執行個體的網域網址。例如:www.example.com

    由於網址篩選器 (優先順序 1000) 允許封包,因此要求成功。

  3. 如要關閉「透過瀏覽器建立 SSH 連線」,請輸入 exit

查看網址篩選服務記錄

  1. 前往「Logs Explorer」
  2. 在「Query」(查詢) 窗格中輸入下列查詢。將 PROJECT_ID 替換為專案 ID。

      resource.type="networksecurity.googleapis.com/FirewallEndpoint" logName="projects/PROJECT_ID/logs/networksecurity.googleapis.com%2Ffirewall_url_filter"
    

清除所用資源

如要避免系統向您的 Google Cloud 帳戶收取本教學課程所用資源的費用,請刪除含有相關資源的專案,或者保留專案但刪除個別資源。

在本節中,您將刪除在本教學課程中建立的資源。

刪除防火牆端點關聯

控制台

  1. 前往 Google Cloud 控制台的「VPC Networks」(虛擬私有雲網路) 頁面。

    前往「VPC networks」(虛擬私有雲網路)

  2. 按一下 vpc-urlf 網路,顯示其「虛擬私有雲網路詳細資料」頁面。

  3. 選取「防火牆端點」分頁標籤。這個分頁會列出已設定的防火牆端點關聯。

  4. 勾選「endpoint-association-urlf」旁的核取方塊,然後按一下「刪除」

  5. 再按一下 [刪除] 加以確認。

gcloud

如要刪除防火牆端點關聯,請執行下列指令:

gcloud network-security firewall-endpoint-associations \
    delete endpoint-association-urlf \
    --zone asia-southeast1-a

刪除防火牆端點

控制台

  1. 前往 Google Cloud 控制台的「Firewall endpoints」(防火牆端點) 頁面。

    前往「防火牆端點」

  2. 選取 endpoint-urlf,然後按一下「Delete」(刪除)

  3. 再按一下 [刪除] 加以確認。

gcloud

如要刪除防火牆端點,請執行下列指令:

gcloud network-security firewall-endpoints delete endpoint-urlf \
    --organization ORGANIZATION_ID \
    --zone asia-southeast1-a

更改下列內容:

  • ORGANIZATION_ID:建立端點的機構。

刪除全域網路防火牆政策

控制台

  1. 前往 Google Cloud 控制台的「Firewall policies」(防火牆政策) 頁面。

    前往「Firewall policies」(防火牆政策)

  2. 在專案選取器選單中,選取含有政策的專案。

  3. 按一下 [fw-policy-urlf]

  4. 按一下「關聯項目」分頁標籤。

  5. 選取所有關聯。

  6. 按一下「移除關聯項目」

  7. 移除所有關聯後,按一下「刪除」

gcloud

  1. 如要移除防火牆政策與虛擬私有雲網路之間的關聯,請執行下列指令:

    gcloud compute network-firewall-policies associations delete \
      --name fw-pol-association-urlf \
      --firewall-policy fw-policy-urlf \
      --global-firewall-policy
    
  2. 刪除防火牆政策。

    gcloud compute network-firewall-policies delete fw-policy-urlf --global
    

    系統提示時,請按下 Y 確認,然後按下 Enter 鍵。

刪除安全性設定檔群組

控制台

  1. 前往 Google Cloud 控制台的「Security profiles」(安全性設定檔) 頁面。

    前往「安全性設定檔」

  2. 選取「安全性設定檔群組」分頁標籤。

  3. 選取 sec-profile-group-urlf,然後按一下「Delete」(刪除)

  4. 再按一下 [刪除] 加以確認。

gcloud

如要刪除安全性設定檔群組,請執行下列指令:

gcloud network-security security-profile-groups \
    delete sec-profile-group-urlf \
    --organization ORGANIZATION_ID \
    --location global

更改下列內容:

  • ORGANIZATION_ID:建立安全性設定檔群組的機構。

刪除網址篩選安全性設定檔

控制台

  1. 前往 Google Cloud 控制台的「Security profiles」(安全性設定檔) 頁面。

    前往「安全性設定檔」

  2. 選取「安全性設定檔」分頁標籤。這個分頁會顯示已設定的安全設定檔清單。

  3. 選取 sec-profile-urlf,然後按一下「Delete」(刪除)

  4. 再按一下 [刪除] 加以確認。

gcloud

如要刪除安全性設定檔,請執行下列指令:

gcloud network-security security-profiles url-filtering \
    delete sec-profile-urlf \
    --organization ORGANIZATION_ID \
    --location global

更改下列內容:

  • ORGANIZATION_ID:建立安全設定檔的機構。

刪除 VM

控制台

  1. 前往 Google Cloud 控制台的「VM instances」(VM 執行個體) 頁面

    前往 VM 執行個體

  2. 勾選 vm-client-urlfvm-server-urlf VM 的核取方塊。

  3. 點選「刪除」。

  4. 在「Delete 2 instances」(刪除 2 個執行個體) 對話方塊中,按一下「Delete」(刪除)

gcloud

  1. 如要刪除 vm-client-urlf VM,請執行下列指令:

    gcloud compute instances delete vm-client-urlf \
      --zone us-central1-a
    

    系統提示時,請按下 Y 確認,然後按下 Enter 鍵。

  2. 如要刪除 vm-server-urlf VM,請執行下列指令:

    gcloud compute instances delete vm-server-urlf \
      --zone asia-southeast1-a
    

    系統提示時,請按下 Y 確認,然後按下 Enter 鍵。

刪除 Cloud NAT 閘道和 Cloud Router

控制台

  1. 前往 Google Cloud 控制台的「Cloud NAT」頁面。

    前往 Cloud NAT

  2. 勾選 gateway-urlf 閘道設定旁的核取方塊。

  3. 在「選單」中,按一下「刪除」

  4. 前往 Google Cloud 控制台的「Cloud Router」頁面。

    前往 Cloud Router

  5. 勾選 router-urlf 路由器旁的核取方塊。

  6. 點選「刪除」。

gcloud

  1. 如要刪除 Cloud NAT 閘道,請執行下列指令:

    gcloud compute routers nats delete gateway-urlf \
      --router=router-urlf \
      --region=asia-southeast1
    
  2. 如要刪除 Cloud Router,請執行下列指令:

    gcloud compute routers delete router-urlf \
      --project=PROJECT_ID \
      --region=asia-southeast1
    

更改下列內容:

  • PROJECT_ID:包含 Cloud Router 的專案 ID。

刪除虛擬私有雲網路及其子網路

控制台

  1. 前往 Google Cloud 控制台的「VPC Networks」(虛擬私有雲網路) 頁面。

    前往「VPC networks」(虛擬私有雲網路)

  2. 在「Name」(名稱) 欄中,按一下 vpc-urlf

  3. 按一下「刪除虛擬私有雲網路」

  4. 在「刪除網路」對話方塊中,按一下「刪除」

刪除 VPC 時,子網路也會一併刪除。

gcloud

  1. 如要刪除 vpc-urlf 虛擬私有雲網路的子網路 subnet-client-urlf,請執行下列指令:

    gcloud compute networks subnets delete subnet-client-urlf \
        --region us-central1
    

    系統提示時,請按下 Y 確認,然後按下 Enter 鍵。

  2. 如要刪除 vpc-urlf 虛擬私有雲網路的子網路 subnet-server-urlf,請執行下列指令:

    gcloud compute networks subnets delete subnet-server-urlf \
        --region=asia-southeast1
    

    系統提示時,請按下 Y 確認,然後按下 Enter 鍵。

  3. 如要刪除 vpc-urlf 虛擬私有雲網路,請執行下列指令:

    gcloud compute networks delete vpc-urlf
    

刪除 DNS 區域

刪除您為伺服器 VM 網域網址建立的 DNS 區域

後續步驟