Mengamankan IAP untuk penerusan TCP dengan Kontrol Layanan VPC
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Halaman ini menjelaskan cara menggunakan Kontrol Layanan VPC untuk melindungi
IAP untuk penerusan TCP, dan cara menggunakan IAP
untuk penerusan TCP dalam perimeter Kontrol Layanan VPC.
Tambahkan project yang berisi instance Compute Engine yang ingin Anda
hubungkan dengan IAP ke project dalam
perimeter layanan Anda. Jika Anda menjalankan IAP untuk klien TCP
di instance Compute Engine, masukkan juga project
yang berisi instance ini ke dalam perimeter.
Tambahkan Identity-Aware Proxy TCP API ke daftar layanan yang dilindungi oleh
perimeter layanan Anda.
Jika Anda membuat perimeter layanan tanpa menambahkan project dan
layanan yang Anda butuhkan, lihat
Mengelola perimeter
layanan
untuk mempelajari cara mengupdate perimeter layanan.
Mengonfigurasi data DNS menggunakan Cloud DNS
Jika IAP untuk klien TCP, yang kemungkinan adalah
Google Cloud CLI, tidak berjalan di dalam perimeter apa pun, Anda dapat melewati langkah ini. Di sisi lain, jika menjalankan klien di dalam
perimeter, Anda harus mengonfigurasi data DNS untuk IAP untuk TCP.
IAP untuk TCP menggunakan domain yang bukan subdomain dari
googleapis.com. Dengan Cloud DNS, tambahkan data DNS untuk memastikan bahwa jaringan VPC Anda menangani permintaan yang dikirim ke domain tersebut dengan benar. Untuk
mempelajari rute VPC lebih lanjut, baca
Ringkasan rute.
Gunakan langkah-langkah berikut untuk membuat zona terkelola untuk domain, menambahkan
data DNS untuk merutekan permintaan, dan menjalankan transaksi. Anda dapat menggunakan gcloud CLI dengan terminal pilihan Anda atau menggunakan Cloud Shell, yang telah menginstal gcloud CLI.
Konfigurasikan
DNS *.googleapis.com seperti biasa untuk integrasi Kontrol Layanan VPC.
Kumpulkan informasi ini untuk digunakan saat mengonfigurasi data DNS:
PROJECT_ID adalah ID project yang menghosting jaringan VPC Anda.
NETWORK_NAME adalah nama jaringan VPC tempat
Anda menjalankan IAP untuk klien TCP.
ZONE_NAME adalah nama untuk zona yang Anda buat. Contoh,
iap-tcp-zone.
Buat zona terkelola pribadi untuk domain tunnel.cloudproxy.app agar jaringan VPC dapat menanganinya.
gclouddnsmanaged-zonescreateZONE_NAME\--visibility=private\--networks=https://www.googleapis.com/compute/v1/projects/PROJECT_ID/global/networks/NETWORK_NAME\--dns-name=tunnel.cloudproxy.app\--description="Description of your managed zone"
Tambahkan data DNS CNAME berikut untuk mengarah ke data A yang baru saja Anda
tambahkan. Tindakan ini akan mengalihkan semua traffic yang cocok dengan domain ke alamat IP
yang tercantum di langkah sebelumnya.
Sebagai ganti Cloud DNS, Anda dapat menggunakan
BIND. Dalam hal ini,
ikuti petunjuk untuk
mengonfigurasi DNS dengan
BIND,
tetapi gunakan IAP untuk domain TCP, bukan domain
googleapis.com umum.
Menggunakan VIP pribadi
Daripada menggunakan VIP yang dibatasi, Anda mungkin dapat menggunakan
VIP pribadi,
bergantung pada cara Anda mengonfigurasi perimeter dan jaringan. Jika Anda lebih memilih
untuk melakukannya, gunakan
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-08-18 UTC."],[[["\u003cp\u003eThis page explains how to use VPC Service Controls to safeguard IAP for TCP forwarding, including using IAP for TCP forwarding within a VPC Service Controls perimeter.\u003c/p\u003e\n"],["\u003cp\u003eA service perimeter can be created to protect Google-managed resources, and when doing so, the project with the Compute Engine instance must be added, as well as Identity-Aware Proxy TCP API.\u003c/p\u003e\n"],["\u003cp\u003eDNS records need to be configured for IAP for TCP if the client runs inside a perimeter, ensuring that the VPC network properly handles requests to non-\u003ccode\u003egoogleapis.com\u003c/code\u003e domains, especially \u003ccode\u003etunnel.cloudproxy.app\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eTo configure DNS, a private managed zone is created for \u003ccode\u003etunnel.cloudproxy.app\u003c/code\u003e, with DNS A and CNAME records added to reroute traffic to Google's restricted VIP or the private VIP, depending on network configuration.\u003c/p\u003e\n"],["\u003cp\u003eWhen utilizing a shared VPC, it's essential to include both the host and service projects within the service perimeter to maintain proper access control.\u003c/p\u003e\n"]]],[],null,["# Securing IAP for TCP forwarding with VPC Service Controls\n\nThis page describes how to use VPC Service Controls to protect\nIAP for TCP forwarding, and how to use IAP\nfor TCP forwarding within a VPC Service Controls perimeter.\n\nBefore you begin\n----------------\n\n1. Read the [Overview of\n VPC Service Controls](/vpc-service-controls/docs/overview).\n\n2. [Set up](/iap/docs/using-tcp-forwarding) usage of IAP TCP\n forwarding without a service perimeter.\n\n3. [Create a service perimeter using\n VPC Service Controls](/vpc-service-controls/docs/create-service-perimeters).\n This service perimeter protects the Google-managed resources of services\n that you specify. When you create your service perimeter, do the following:\n\n 1. Add the project that contains the Compute Engine instance you want to\n connect to with IAP to the projects within your\n service perimeter. If you are running an IAP for TCP\n client on a Compute Engine instance, also put the project\n containing this instance into the perimeter.\n\n 2. Add **Identity-Aware Proxy TCP API** to the list of services protected by your\n service perimeter.\n\n If you created your service perimeter without adding the projects and\n services you need, see\n [Managing service\n perimeters](/vpc-service-controls/docs/manage-service-perimeters)\n to learn how to update your service perimeter.\n\nConfigure your DNS records using Cloud DNS\n------------------------------------------\n\nIf your IAP for TCP client, which is likely the\n[Google Cloud CLI](/sdk/gcloud), is not running inside any perimeter, then\nyou can skip this step. On the other hand, if you run the client inside a\nperimeter, you must configure DNS records for IAP for TCP.\n\nIAP for TCP uses domains that are not subdomains of\n`googleapis.com`. Using Cloud DNS, add DNS records to ensure that your\nVPC network correctly handles requests sent to those domains. To\nlearn more about VPC routes, read the\n[Routes overview](/vpc/docs/routes).\n\nUse the following steps to create a [managed zone](/dns/zones) for a domain, add\nDNS records to route requests, and execute the transaction. You can use the\ngcloud CLI with your preferred terminal or use\n[Cloud Shell](/shell/docs/using-cloud-shell), which has the\ngcloud CLI preinstalled.\n\n1. [Configure](/vpc-service-controls/docs/set-up-private-connectivity#configuring_dns_with)\n the `*.googleapis.com` DNS as is typical for VPC Service Controls\n integrations.\n\n2. Collect this information to use when configuring your DNS records:\n\n - \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e is the ID of the project that hosts your\n VPC network.\n\n - \u003cvar translate=\"no\"\u003eNETWORK_NAME\u003c/var\u003e is the name of the VPC network in\n which you are running your IAP for TCP client.\n\n - \u003cvar translate=\"no\"\u003eZONE_NAME\u003c/var\u003e is a name for the zone that you are creating. For\n example, `iap-tcp-zone`.\n\n3. Create a private managed zone for the domain `tunnel.cloudproxy.app` so the\n VPC network can handle it.\n\n ```bash\n gcloud dns managed-zones create ZONE_NAME \\\n --visibility=private \\\n --networks=https://www.googleapis.com/compute/v1/projects/PROJECT_ID/global/networks/NETWORK_NAME \\\n --dns-name=tunnel.cloudproxy.app \\\n --description=\"Description of your managed zone\"\n ```\n4. Start a transaction.\n\n ```bash\n gcloud dns record-sets transaction start --zone=ZONE_NAME\n ```\n5. Add the following DNS A record. This reroutes traffic to Google's\n [restricted VIP](/vpc-service-controls/docs/set-up-private-connectivity)\n (virtual IP address).\n\n ```bash\n gcloud dns record-sets transaction add \\\n --name=tunnel.cloudproxy.app. \\\n --type=A 199.36.153.4 199.36.153.5 199.36.153.6 199.36.153.7 \\\n --zone=ZONE_NAME \\\n --ttl=300\n ```\n6. Add the following DNS CNAME record to point to the A record that you just\n added. This redirects all traffic matching the domain to the IP addresses\n listed in the previous step.\n\n ```bash\n gcloud dns record-sets transaction add \\\n --name=\"*.tunnel.cloudproxy.app.\" \\\n --type=CNAME tunnel.cloudproxy.app. \\\n --zone=ZONE_NAME \\\n --ttl=300\n ```\n7. Execute the transaction.\n\n ```bash\n gcloud dns record-sets transaction execute --zone=ZONE_NAME\n ```\n\n### Configuring DNS with BIND\n\nInstead of using Cloud DNS, you can use\n[BIND](https://www.wikipedia.org/wiki/BIND). In that case,\nfollow the directions for\n[configuring DNS with\nBIND](/vpc-service-controls/docs/set-up-private-connectivity#configuring_dns_with_bind),\nbut use the IAP for TCP domains instead of the general\n`googleapis.com` domains.\n\n### Using the private VIP\n\nInstead of using the restricted VIP, it might be possible to use the\n[private VIP](/vpc/docs/configure-private-google-access-hybrid#config-choose-domain),\ndepending on how you've configured your perimeter and network. If you prefer to\ndo that, then use\n\n`199.36.153.8 199.36.153.9 199.36.153.10 199.36.153.11`\n\nin place of\n\n`199.36.153.4 199.36.153.5 199.36.153.6 199.36.153.7`\n\nin the instructions for configuring your DNS records.\n\nUsing a shared VPC\n------------------\n\nIf you're using a [shared VPC](/vpc/docs/shared-vpc),\nyou must add the host and the service projects to the service perimeter. See\n[Managing service\nperimeters](/vpc-service-controls/docs/manage-service-perimeters).\n\nWhat's next\n-----------\n\n- See [Managing service\n perimeters](/vpc-service-controls/docs/manage-service-perimeters) to add more resources to your service perimeter."]]