IAP für TCP-Weiterleitung mit VPC Service Controls sichern
Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Auf dieser Seite wird beschrieben, wie Sie VPC Service Controls zum Schutz von IAP zur TCP-Weiterleitung verwenden und wie Sie IAP zur TCP-Weiterleitung in einem VPC Service Controls-Perimeter verwenden.
Fügen Sie das Projekt mit der Compute Engine-Instanz, zu der Sie über IAP eine Verbindung herstellen möchten, zu den Projekten in Ihrem Dienstperimeter hinzu. Wenn Sie einen IAP für TCP-Client auf einer Compute Engine-Instanz ausführen, fügen Sie das Projekt mit dieser Instanz ebenfalls zum Perimeter hinzu.
Fügen Sie die Identity-Aware Proxy TCP API der Liste der Dienste hinzu, die durch Ihren Dienstperimeter geschützt sind.
Wenn Sie Ihren Dienstperimeter erstellt haben, ohne die benötigten Projekte und Dienste einzufügen, erfahren Sie unter Dienstperimeter verwalten, wie Sie Ihren Dienstperimeter aktualisieren.
DNS-Einträge mit Cloud DNS konfigurieren
Wenn Ihr IAP für TCP-Client, also wahrscheinlich die Google Cloud CLI, nicht in einem Perimeter ausgeführt wird, können Sie diesen Schritt überspringen. Wenn Sie den Client jedoch in einem Perimeter ausführen, müssen Sie DNS-Einträge für IAP für TCP konfigurieren.
IAP für TCP verwendet Domains, die keine Subdomains von googleapis.com sind. Fügen Sie DNS-Einträge mithilfe von Cloud DNS hinzu, damit Ihr VPC-Netzwerk Anfragen, die an diese Domains gesendet werden, ordnungsgemäß verarbeitet. Weitere Informationen zu VPC-Routen finden Sie in der Routenübersicht.
Führen Sie folgende Schritte aus, um eine verwaltete Zone für eine Domain zu erstellen, DNS-Einträge zur Weiterleitung von Anfragen hinzuzufügen und die Transaktion auszuführen. Sie können die gcloud CLI mit Ihrem bevorzugten Terminal oder mit der Cloud Shell verwenden, in der die gcloud CLI vorinstalliert ist.
Konfigurieren Sie das *.googleapis.com-DNS wie gewohnt für VPC Service Controls-Integrationen.
Legen Sie diese Informationen beim Konfigurieren der DNS-Einträge fest:
PROJECT_ID ist die ID des Projekts, in dem Ihr VPC-Netzwerk gehostet wird.
NETWORK_NAME ist der Name des VPC-Netzwerks, in dem Sie den IAP für TCP-Client ausführen.
ZONE_NAME ist ein Name für die Zone, die Sie erstellen. Beispiel: iap-tcp-zone
Erstellen Sie eine private verwaltete Zone für die Domain tunnel.cloudproxy.app, damit sie vom VPC-Netzwerk verarbeitet werden kann.
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"
Geben Sie den folgenden DNS-CNAME-Eintrag an, um auf den gerade hinzugefügten A-Eintrag zu verweisen. Dadurch wird der gesamte Traffic, der mit der Domain übereinstimmt, an die im vorherigen Schritt aufgeführten IP-Adressen umgeleitet.
Anstelle von Cloud DNS können Sie BIND verwenden. Folgen Sie in diesem Fall der Anleitung zum Konfigurieren von DNS mit BIND, verwenden Sie aber den IAP für TCP-Domains anstelle der allgemeinen googleapis.com-Domains.
Private VIP-Adresse verwenden
Anstelle der eingeschränkten VIP kann, je nachdem, wie Sie Ihren Perimeter und Ihr Netzwerk konfiguriert haben, auch der private VIP verwendet werden. Wenn Sie diese Vorgehensweise bevorzugen, verwenden Sie
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 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."]]