IPv6-Adressen für Instanzen und Instanzvorlagen konfigurieren
Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Sie können IPv6-Adressen auf einer Compute Engine-Instanz konfigurieren, wenn für das Subnetz, mit dem die Instanz verbunden ist, ein IPv6-Bereich konfiguriert ist.
Compute-Instanzen mit IPv4- und IPv6-Konfigurationen sind Dual-Stack.
Die IPv6-Adresse gilt zusätzlich zu den IPv4-Adressen, die auf der Netzwerkschnittstelle konfiguriert sind.
Schnittstellen auf Dual-Stack- oder reinen IPv6-Instanzen werden einem einzelnen /96-Bereich von IPv6-Adressen zugewiesen. Die erste IPv6-Adresse im Bereich (/128) ist auf der Schnittstelle konfiguriert.
Für jede Schnittstelle auf der Instanz können IPv6-Adressen konfiguriert werden. Weitere Informationen zum Konfigurieren mehrerer Netzwerkschnittstellen finden Sie unter Mehrere Netzwerkschnittstellen.
Der Stacktyp der Netzwerkschnittstelle einer VM bestimmt, mit welchen Subnetzen eine Verbindung hergestellt werden kann:
Nur-IPv4-Schnittstellen können eine Verbindung zu Dual-Stack- und reinen IPv4-Subnetzen herstellen.
Dual-Stack-Schnittstellen können eine Verbindung zu Dual-Stack-Subnetzen herstellen.
Nur IPv6-Schnittstellen können eine Verbindung zu Dual-Stack- und reinen IPv6-Subnetzen herstellen (Vorabversion).
Zum Konfigurieren von IPv6-Adressen auf einer Netzwerkschnittstelle muss die Schnittstelle mit einem Dual-Stack- oder reinen IPv6-Subnetz verbunden sein (Vorabversion).
Die IPv6-Zugriffstypkonfiguration eines Subnetzes bestimmt, ob das Subnetz einen internen oder externen IPv6-Bereich hat. Verbundene Instanzen übernehmen den IPv6-Zugriffstyp aus dem Subnetz.
Reine IPv6-Instanzen (Vorabversion) werden nur mit Ubuntu und Debian unterstützt.
Über IPv6-Adressen auf Instanzen zugreifen
Die implizierte Firewallregel zum Ablehnen von eingehendem IPv6 schützt Instanzen durch Blockieren eingehender Verbindungen an deren IPv6-Adressen.
Für den Zugriff auf Instanzen über ihre IPv6-Adressen benötigen Sie eine Regel mit höherer Priorität, die eingehenden Zugriff zulässt.
In der folgenden Liste wird beschrieben, wie IPv6-Adressen Compute Engine-Instanzen zugewiesen werden.
Compute-Instanzen wird eine IPv6-Adresse mithilfe von DHCPv6 zugewiesen. Der Metadatenserver antwortet auf die DHCPv6-Anfragen der Instanz und sendet als Antwort die erste IPv6-Adresse (/128) aus dem zugewiesenen /96-Bereich.
Der Metadatenserver verwendet Route Advertisement, um die Standardroute auf der Instanz zu veröffentlichen. Die Instanz kann diese Standardroute dann für den gesamten IPv6-Traffic verwenden.
Sie können die Standardroute für die Netzwerkschnittstelle einer Instanz ermitteln, indem Sie eine Verbindung zur Instanz herstellen und den Metadatenserver nach dem Eintrag gateway-ipv6 abfragen.
Compute-Instanzen werden mit Link-Local-IP-Adressen konfiguriert, die aus dem Bereich fe80::/10 zugewiesen sind. Sie werden jedoch nur für die Nachbarnerkennung verwendet.
Die MTU-Konfiguration in der Netzwerkschnittstelle der Instanz gilt sowohl für IPv4- als auch für IPv6-Pakete. Es werden jedoch nicht alle MTU-Werte in allen Fällen unterstützt. Weitere Informationen finden Sie unter Maximale Übertragungseinheit.
Instanz mit IPv6-Adressen erstellen
Sie können eine Instanz erstellen, die entweder eine Kombination aus IPv4- und IPv6-Adressen (Dual-Stack) oder nur IPv6-Adressen verwendet.
Informationen zum Erstellen einer Compute Engine-Instanz, die IPv6-Adressen verwendet, finden Sie in den folgenden Aufgaben:
Sie können den Stacktyp einer vorhandenen Compute Engine-Instanz ändern.
Für den Stacktyp ist einer der folgenden Werte festgelegt:
Nur IPv4 (einzelner Stack)
IPv4 und IPv6 (Dual-Stack)
Wenn Sie den Stacktyp in Dual-Stack ändern, muss die Instanz mit einem Dual-Stack-Subnetz verbunden sein. Wenn Sie das Subnetz ändern müssen, mit dem die Instanz verbunden ist, beenden Sie die Instanz und ändern Sie das Subnetz. Nachdem das Subnetz aktualisiert wurde, können Sie den IP-Stacktyp der Instanz ändern.
Sie können den Stacktyp einer reinen IPv6-Instanz (Vorabversion) nicht ändern.
PROJECT_ID: die ID des Projekts, das die Instanz enthält.
ZONE: die Zone, in der die Instanz bereitgestellt wird.
INSTANCE_NAME: der Name der Instanz.
Beispiel für einen Anfragetext:
{
"stackType": "STACK_TYPE",
}
Ersetzen Sie STACK_TYPE durch den Stacktyp für die Instanz: IPV4_ONLY oder IPV4_IPV6.
Instanzvorlage mit IPv6-Adressen erstellen
Sie können eine regionale oder globale Instanzvorlage erstellen, mit der Dual-Stack- oder reine IPv6-Instanzen (Vorabversion) erstellt werden können.
Weitere Informationen finden Sie unter Instanzvorlagen erstellen.
Sie müssen die Google Cloud CLI oder REST verwenden, um eine Instanzvorlage zu erstellen, die Instanzen mit IPv6-Adressen erstellt.
gcloud
Verwenden Sie zum Erstellen einer regionalen oder globalen Instanzvorlage den gcloud compute instance-templates create-Befehl:
Wenn Sie eine regionale Instanzvorlage erstellen möchten, müssen Sie mit dem Flag --instance-template-region die Region der Vorlage angeben.
Im folgenden Beispiel wird eine globale Instanzvorlage erstellt:
INSTANCE_TEMPLATE_NAME ist der Name der Instanzvorlage.
MACHINE_TYPE: den Maschinentyp der Instanzen.
Beispiel: c3-standard-4.
SUBNET: ein Subnetz mit einem IPv6-Subnetzbereich.
REGION: die Region des Subnetzes.
IMAGE_URI: der URI des Images, das Sie verwenden möchten.
Wenn Sie beispielsweise "sourceImage": "projects/debian-cloud/global/images/family/debian-12" angeben, legt Compute Engine eine Instanz aus der neuesten Version des Betriebssystem-Images in der Debian 12-Image-Familie an.
[[["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\u003eCompute Engine instances can be configured with IPv6 addresses if the connected subnet has an IPv6 range, enabling dual-stack (IPv4 and IPv6) or IPv6-only configurations.\u003c/p\u003e\n"],["\u003cp\u003eInstances with dual-stack or IPv6-only configurations are allocated a single /96 range of IPv6 addresses, with the first /128 address configured on the interface, and can only be connected to dual-stack or IPv6-only subnets.\u003c/p\u003e\n"],["\u003cp\u003eIPv6-only instances, currently in preview, are only supported with Ubuntu and Debian operating systems, and their stack type cannot be changed after creation.\u003c/p\u003e\n"],["\u003cp\u003eAccessing instances via IPv6 addresses requires a firewall rule that allows incoming connections, overriding the default implied deny rule for IPv6 ingress traffic.\u003c/p\u003e\n"],["\u003cp\u003eYou can create dual-stack or IPv6-only instances using instance templates that are defined via Google Cloud CLI or REST, enabling you to define which OS, subnet, and stack type they will have.\u003c/p\u003e\n"]]],[],null,["# Configure IPv6 addresses for instances and instance templates\n\n*** ** * ** ***\n\nYou can configure IPv6 addresses on a Compute Engine instance if the\nsubnet that the instance is connected to has an IPv6 range configured.\n\nFor more information about IPv6, see\n[IPv6 subnet ranges](/vpc/docs/subnets#ipv6-ranges).\n\nSpecifications\n--------------\n\n- Compute instances that have both IPv4 and IPv6 configurations are *dual-stack*.\n The IPv6 address is in addition to any IPv4 addresses that are configured on\n the network interface.\n\n- Interfaces on dual-stack or IPv6-only instances are allocated a single `/96`\n range of IPv6 addresses; the first IPv6 address in the range (`/128`) is\n configured on the interface.\n\n- Any interface on the instance can have IPv6 addresses configured. For more\n information about configuring multiple network interfaces, see\n [Multiple network interfaces](/vpc/docs/multiple-interfaces-concepts).\n\n- The stack type of an VM's network interface determines the type of subnets\n to which it can connect:\n\n - IPv4-only interfaces can connect to dual-stack and IPv4-only subnets.\n - Dual-stack interfaces can connect to dual-stack subnets.\n - IPv6-only interfaces can connect to dual-stack and IPv6-only subnets.\n- To configure IPv6 addresses on a network interface, the interface must be\n connected to a dual stack or IPv6-only\n [subnet](/vpc/docs/subnets#subnet-types).\n\n- A subnet's IPv6 access type configuration determines whether the subnet has an\n internal or external IPv6 range. Connected instances inherit the IPv6 access\n type from the subnet.\n\n- IPv6-only instances are supported with only Ubuntu and Debian OS images.\n\nAccessing instances using IPv6 addresses\n----------------------------------------\n\nThe [implied IPv6 deny ingress firewall rule](/vpc/docs/firewalls#default_firewall_rules)\nprotects instances by blocking incoming connections to their IPv6 addresses.\nTo access instances using their IPv6 addresses, you must have a higher priority\nrule that allows incoming access.\n\nFor more information about firewall rules, see\n[VPC firewall rules](/firewall/docs/firewalls) and\n[Hierarchical firewall policies](/firewall/docs/firewall-policies).\n\nFor examples of VPC firewall rules, see\n[Configure firewall rules for common use cases](/vpc/docs/using-firewalls#rules-for-common-use-cases).\n\nIPv6 address assignment\n-----------------------\n\nThe following list describes how IPv6 addresses are assigned to compute\ninstances.\n\n- Compute instances are assigned an IPv6 address using DHCPv6. The metadata\n server responds to the instance's DHCPv6 requests and sends the first\n IPv6 address (`/128`) from the allocated `/96` range in response.\n\n- The metadata server uses route advertisement to publish the default route to\n the instance. The instance can then use this default route for all IPv6\n traffic.\n\n You can find the default route for an instance's network interface by\n connecting to the instance and querying the metadata server for the\n `gateway-ipv6` entry. \n\n ```\n curl http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/gateway-ipv6 -H \"Metadata-Flavor: Google\"\n ```\n\n For more information about the metadata server, see\n [View and query instance metadata](/compute/docs/metadata/querying-metadata).\n- Compute instances are configured with link local IP addresses, which are\n assigned from the `fe80::/10` range, but they are used only for\n [neighbor discovery](https://en.wikipedia.org/wiki/Neighbor_Discovery_Protocol).\n\n- The MTU configuration on the instance's network interface applies to both\n IPv4 and IPv6 packets, but not all MTU values are supported in all\n circumstances. For more information, see\n [Maximum transmission unit](/vpc/docs/mtu).\n\nCreate an instance that uses IPv6 addresses\n-------------------------------------------\n\nYou can create an instance that uses either a combination of IPv4 and IPv6\naddresses (*dual-stack*), or you can create an instance that uses only IPv6\naddresses.\n\nFor information about how to create a Compute Engine instance that uses\nIPv6 addresses, see the following tasks:\n\n- [Create a dual-stack instance](/compute/docs/instances/create-ipv6-instance#create-vm-ipv6-dual)\n- [Create an IPv6-only instance](/compute/docs/instances/create-ipv6-instance#create-vm-ipv6-only)\n\nChange the stack type of an instance\n------------------------------------\n\nYou can change the stack type of an existing Compute Engine instance.\nThe stack type can be set to either of the following:\n\n- IPv4 only (single stack)\n- IPv4 and IPv6 (dual-stack)\n\nIf you are changing the stack type to dual-stack, the instance must be connected\nto a dual-stack subnet. If you need to change which subnet the instance is\nconnected to, stop the instance and change the subnet. After the subnet is\nupdated, you can change the instance's IP stack type.\n\nYou can't change the stack type of an IPv6-only instance. \n\n### Console\n\n1. Go to the **VM instances** page.\n\n\n [Go to VM instances](https://console.cloud.google.com/compute/instances)\n2. Click the name of the instance that you want to assign an IPv6 address to.\n\n3. From the instance details page, complete the following steps:\n\n 1. Click **Edit**.\n 2. In **Network interfaces**, expand the interface that you want to edit.\n 3. Select the **IP stack type** : **IPv4 only (single-stack)** or **IPv4 and IPv6 (dual-stack)**.\n 4. Click **Done**.\n4. Click **Save**.\n\n### gcloud\n\nUpdate the stack type of an instance by using the\n[`gcloud compute instances network-interfaces update`\ncommand](/sdk/gcloud/reference/compute/instances/network-interfaces/update) \n\n```\ngcloud compute instances network-interfaces update INSTANCE_NAME \\\n --stack-type=STACK_TYPE \\\n --zone=ZONE\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eINSTANCE_NAME\u003c/var\u003e: the name of the instance.\n- \u003cvar translate=\"no\"\u003eSTACK_TYPE\u003c/var\u003e: the stack type for the instance: `IPV4_ONLY` or `IPV4_IPV6`.\n- \u003cvar translate=\"no\"\u003eZONE\u003c/var\u003e: the zone that the instance is deployed in.\n\n### REST\n\nUpdate the stack type of an instance by making a `PATCH` request to the\n[`instances.updateNetworkInterface`\nmethod](/compute/docs/reference/rest/v1/instances/updateNetworkInterface). \n\n```\nPATCH https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/INSTANCE_NAME/updateNetworkInterface\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the ID of the project that contains the instance.\n- \u003cvar translate=\"no\"\u003eZONE\u003c/var\u003e: the zone that the instance is deployed in.\n- \u003cvar translate=\"no\"\u003eINSTANCE_NAME\u003c/var\u003e: the name of the instance.\n\nExample request body: \n\n```\n{\n \"stackType\": \"STACK_TYPE\",\n}\n```\n\nReplace \u003cvar translate=\"no\"\u003eSTACK_TYPE\u003c/var\u003e with the stack type for the instance:\n`IPV4_ONLY` or `IPV4_IPV6`.\n\nCreate an instance template with IPv6 addresses\n-----------------------------------------------\n\nYou can create a regional or global instance template that can be used to create\ndual-stack or IPv6-only instances. For more information, see\n[Create instance templates](/compute/docs/instance-templates/create-instance-templates).\n\nYou must use the Google Cloud CLI or REST to create an instance\ntemplate that creates instances that use IPv6 addresses. \n\n### gcloud\n\nTo create a regional or global instance template, use the\n[`gcloud compute instance-templates create` command](/sdk/gcloud/reference/compute/instance-templates/create).\nIf you want to create a regional instance template, you must use the\n`--instance-template-region` flag to specify the region for the instance\ntemplate.\n\nThe following example creates a global instance template: \n\n```\ngcloud compute instance-templates create TEMPLATE_NAME \\\n --subnet=SUBNET \\\n --stack-type=STACK_TYPE\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eTEMPLATE_NAME\u003c/var\u003e: the name for the template.\n- \u003cvar translate=\"no\"\u003eSUBNET\u003c/var\u003e: a subnet that has an IPv6 subnet range.\n- \u003cvar translate=\"no\"\u003eSTACK_TYPE\u003c/var\u003e: the stack type, either IPV4_IPV6 for a dual-stack instance, or IPV6_ONLY for an instance with external IPv6 address.\n\n### REST\n\nTo create a regional instance template, use the\n[`regionInstanceTemplates.insert` method](/compute/docs/reference/rest/v1/regionInstanceTemplates/insert),\nor, to create a global instance template, use the\n[`instanceTemplates.insert` method](/compute/docs/reference/rest/v1/instanceTemplates/insert).\n\nThe following example creates a global instance template: \n\n```\nPOST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/global/instanceTemplates\n```\n\nReplace \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e with the project ID.\n\nExample request body: \n\n```\n{\n \"name\": \"INSTANCE_TEMPLATE_NAME\"\n \"properties\": {\n \"machineType\": \"MACHINE_TYPE\",\n \"networkInterfaces\": [\n {\n \"subnetwork\": \"regions/REGION/subnetworks/SUBNET\",\n \"stackType\": \"STACK_TYPE\",\n },\n ],\n \"disks\":\n [\n {\n \"type\": \"PERSISTENT\",\n \"boot\": true,\n \"mode\": \"READ_WRITE\",\n \"initializeParams\":\n {\n \"sourceImage\": \"IMAGE_URI\"\n }\n }\n ]\n }\n}\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eINSTANCE_TEMPLATE_NAME\u003c/var\u003e: the name of the instance template.\n- \u003cvar translate=\"no\"\u003eMACHINE_TYPE\u003c/var\u003e: the machine type of the instances. For example, `c3-standard-4`.\n- \u003cvar translate=\"no\"\u003eSUBNET\u003c/var\u003e: a subnet that has an IPv6 subnet range.\n- \u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e: the region of the subnet.\n- \u003cvar translate=\"no\"\u003eIMAGE_URI\u003c/var\u003e: the URI to the\n [image](/compute/docs/images) that you want to use.\n\n For example, if you specify\n `\"sourceImage\": \"projects/debian-cloud/global/images/family/debian-12\"`,\n Compute Engine creates an instance from the latest version of the\n operating system image in the Debian 12 image family.\n\nTo learn more about request parameters, see the\n[`instanceTemplates.insert` method](/compute/docs/reference/rest/v1/instanceTemplates/insert)."]]