Menggunakan Public NAT dengan Compute Engine

Halaman ini menunjukkan demonstrasi gateway Public NAT yang menyediakan layanan penafsiran alamat jaringan untuk instance VM Compute Engine. Sebelum Anda memulai, baca Ringkasan Public NAT.

Prasyarat

Anda harus melakukan hal berikut sebelum menyiapkan Public NAT.

Mendapatkan izin IAM

Peran roles/compute.networkAdmin memberi Anda izin untuk membuat gateway NAT di Cloud Router, mencadangkan dan menetapkan alamat IP NAT, serta menentukan subnetwork (subnet) yang traffic-nya harus menggunakan terjemahan alamat jaringan oleh gateway NAT.

Menyiapkan Google Cloud

Sebelum Anda memulai, siapkan item berikut di Google Cloud.

  1. Login ke akun Google Cloud Anda. Jika Anda baru menggunakan Google Cloud, buat akun untuk mengevaluasi performa produk kami dalam skenario dunia nyata. Pelanggan baru juga mendapatkan kredit gratis senilai $300 untuk menjalankan, menguji, dan men-deploy workload.
  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. Instal Google Cloud CLI.

  5. Jika Anda menggunakan penyedia identitas (IdP) eksternal, Anda harus login ke gcloud CLI dengan identitas gabungan Anda terlebih dahulu.

  6. Untuk melakukan inisialisasi gcloud CLI, jalankan perintah berikut:

    gcloud init
  7. 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

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

  9. Instal Google Cloud CLI.

  10. Jika Anda menggunakan penyedia identitas (IdP) eksternal, Anda harus login ke gcloud CLI dengan identitas gabungan Anda terlebih dahulu.

  11. Untuk melakukan inisialisasi gcloud CLI, jalankan perintah berikut:

    gcloud init

Contoh

Berikut adalah contoh end-to-end yang menunjukkan contoh gateway Public NAT dan contoh VM Compute Engine yang menggunakan gateway Public NAT.

Langkah 1: Buat jaringan dan subnet VPC

Jika sudah memiliki jaringan dan subnet, Anda dapat melewati langkah ini.

Konsol

  1. Di konsol Google Cloud , buka halaman VPC networks.

    Buka halaman Jaringan VPC

  2. Klik Create VPC network.

  3. Masukkan Nama custom-network1.

  4. Di bagian Subnets, tetapkan Subnet creation mode ke Custom.

  5. Di bagian New subnet, masukkan Name subnet-us-east-192.

  6. Di Region, pilih us-east4.

  7. Masukkan IP address range 192.168.1.0/24.

  8. Klik Done, lalu klik Create.

gcloud