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.
- 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.
-
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 theresourcemanager.projects.createpermission. Learn how to grant roles.
-
Verify that billing is enabled for your Google Cloud project.
-
Instal Google Cloud CLI.
-
Jika Anda menggunakan penyedia identitas (IdP) eksternal, Anda harus login ke gcloud CLI dengan identitas gabungan Anda terlebih dahulu.
-
Untuk melakukan inisialisasi gcloud CLI, jalankan perintah berikut:
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 role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
-
Verify that billing is enabled for your Google Cloud project.
-
Instal Google Cloud CLI.
-
Jika Anda menggunakan penyedia identitas (IdP) eksternal, Anda harus login ke gcloud CLI dengan identitas gabungan Anda terlebih dahulu.
-
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
Di konsol Google Cloud , buka halaman VPC networks.
Klik Create VPC network.
Masukkan Nama
custom-network1.Di bagian Subnets, tetapkan Subnet creation mode ke Custom.
Di bagian New subnet, masukkan Name
subnet-us-east-192.Di Region, pilih us-east4.
Masukkan IP address range
192.168.1.0/24.Klik Done, lalu klik Create.