Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Hybrid NAT
Mit Hybrid-NAT, einer Art von Privatem NAT, können Sie die Network Address Translation (NAT) zwischen einem VPC-Netzwerk (Virtual Private Cloud) und einem lokalen Netzwerk oder einem Netzwerk eines anderen Cloud-Anbieters ausführen. Das andere Netzwerk muss über die Netzwerkkonnektivitätsprodukte von Google Cloudwie Cloud Interconnect oder Cloud VPN mit Ihrem VPC-Netzwerk verbunden sein.Google Cloud
Mit Hybrid-NAT kann ein VPC-Netzwerk mit einem lokalen Netzwerk oder einem anderen Netzwerk eines Cloud-Anbieters kommunizieren, auch wenn sich die IP-Adressbereiche der Subnetze der Netzwerke überschneiden. Mit einer NAT-Konfiguration von type=PRIVATE können Ressourcen sowohl in den sich überschneidenden als auch in den nicht überschneidenden Subnetzen des VPC-Netzwerks eine Verbindung zu Ressourcen in den nicht überschneidenden Subnetzen des Nicht-Google Cloud-Netzwerks herstellen.
Um Hybrid-NAT zu aktivieren, muss das Nicht-Google Cloud -Netzwerk seine dynamischen Routen ankündigen, damit Ihr VPC-Netzwerk sie lernen und verwenden kann. Diese dynamischen Routen werden von Ihrem Cloud Router aus den Netzwerkkonnektivitätsprodukten von Google Cloudabgeleitet, z. B. Cloud Interconnect, HA VPN oder klassisches VPN mit konfiguriertem dynamischen Routing. Die Ziele dieser dynamischen Routen sind IP-Adressbereiche außerhalb Ihres VPC-Netzwerks.
Ebenso muss Ihr VPC-Netzwerk die Subnetzroute für Private NAT über einen Cloud Router anbieten. Diese Subnetzroute darf sich nicht mit einem vorhandenen Subnetz in den verbundenen Netzwerken überschneiden.
Bei der Hybrid-NAT wird NAT für Traffic ausgeführt, der aus einem VPC-Netzwerk an ein lokales Netzwerk oder ein anderes Netzwerk eines Cloud-Anbieters weitergeleitet wird. Die Netzwerke müssen über Cloud Interconnect oder Cloud VPN verbunden sein.
Hybrid-NAT unterstützt vorhandene klassische VPN-Tunnel nur, wenn dynamisches Routing aktiviert ist.
Sie müssen eine benutzerdefinierte NAT-Regel mit einem Abgleichsausdruck erstellennexthop.is_hybrid. Die NAT-Regel gibt einen NAT-IP-Adressbereich aus einem Subnetz mit dem Zweck PRIVATE_NAT an, den die Ressourcen in Ihrem VPC-Netzwerk für die Kommunikation mit anderen Netzwerken verwenden können.
Der Cloud Router, auf dem Sie Hybrid NAT konfigurieren, muss sich in derselben Region wie das VPC-Netzwerk befinden.
Der Cloud Router, auf dem Sie Hybrid-NAT konfigurieren, darf keine andere NAT-Konfiguration enthalten.
Grundlegende Hybrid-NAT-Konfiguration und -Workflow
Das folgende Diagramm zeigt eine grundlegende Hybrid-NAT-Konfiguration:
Beispiel für Hybrid-NAT-Übersetzung (zum Vergrößern klicken)
In diesem Beispiel ist Hybrid-NAT so eingerichtet:
Das Gateway pvt-nat-gw ist in vpc-a so konfiguriert, dass es auf alle IP-Adressbereiche von subnet-a in der Region us-east1 angewendet wird.
Der Cloud Router und der lokale oder andere Cloud-Anbieter-Router tauschen die folgenden Subnetzrouten aus:
Cloud Router bewirbt 10.1.2.0/29 für den externen Router.
Der externe Router bewirbt 192.168.2.0/24 für Cloud Router.
Wenn der NAT-IP-Adressbereich pvt-nat-gw verwendet wird, kann eine VM-Instanz in subnet-a von vpc-a Traffic an eine VM in subnet-b des lokalen Netzwerks oder eines anderen Cloud-Anbieternetzwerks senden, auch wenn sich subnet-a von vpc-a mit einem anderen Subnetz im Nicht-Google Cloud -Netzwerk überschneidet.
Beispiel für einen Hybrid-NAT-Workflow
Im vorherigen Diagramm muss vm-a mit der internen IP-Adresse 192.168.1.2 in subnet-a von vpc-a ein Update von vm-b mit der internen IP-Adresse 192.168.2.2 in subnet-b eines lokalen Netzwerks oder eines anderen Cloud-Anbieternetzwerks herunterladen. Cloud Interconnect verbindet Ihr VPC-Netzwerk mit dem lokalen Netzwerk oder einem anderen Netzwerk eines Cloud-Anbieters. Angenommen, das andere Netzwerk enthält ein weiteres Subnetz 192.168.1.0/24, das sich mit dem Subnetz in vpc-a überschneidet.Google Cloud
Damit subnet-a von vpc-a mit subnet-b des nichtGoogle Cloud -Netzwerks kommunizieren kann, müssen Sie in vpc-a ein privates NAT-Gateway, pvt-nat-gw, so konfigurieren:
Geben Sie ein Private NAT-Subnetz mit dem Zweck PRIVATE_NAT an, z. B. 10.1.2.0/29. Erstellen Sie dieses Subnetz, bevor Sie das private NAT-Gateway konfigurieren. Achten Sie darauf, dass sich dieses Subnetz nicht mit einem vorhandenen Subnetz in einem der verbundenen Netzwerke überschneidet.
Erstellen Sie eine NAT-Regel mit match='nexthop.is_hybrid'.
Konfigurieren Sie das private NAT-Gateway so, dass es auf alle IP-Adressbereiche von subnet-a angewendet wird.
Hybrid NAT folgt dem Portreservierungsverfahren, um die folgenden Tupel aus NAT-Quell-IP-Adresse und Quellport für jede der VMs im Netzwerk zu reservieren. Das private NAT-Gateway reserviert beispielsweise 64 Quellports für vm-a:10.1.2.2:34000 bis 10.1.2.2:34063.
Wenn die VM ein Paket mit dem TCP-Protokoll an den Update-Server 192.168.2.2 auf dem Zielport 80 sendet, geschieht Folgendes:
Die VM sendet ein Anfragepaket mit folgenden Attributen:
Quell-IP-Adresse: 192.168.1.2, die interne IP-Adresse der VM
Quellport: 24000, der sitzungsspezifische Quellport, der vom Betriebssystem der VM ausgewählt wurde
Zieladresse: 192.168.2.2, die IP-Adresse des Update-Servers
Zielport: 80, der Zielport für HTTP-Traffic zum Update-Server
Protokoll: TCP
Das Gateway pvt-nat-gw führt für ausgehenden Traffic eine Quellnetzwerkadressübersetzung (SNAT oder Source NAT) aus und schreibt die NAT-Quell-IP-Adresse und den Quellport des Anfragepakets um:
NAT-Quell-IP-Adresse: 10.1.2.2 von einem der reservierten Tupel aus NAT-Quell-IP-Adresse und Quellport
Quellport: 34022, ein nicht verwendeter Quellport aus einem der reservierten Quellport-Tupel der VM
Zieladresse: 192.168.2.2, unverändert
Zielport: 80, unverändert
Protokoll: TCP, unverändert
Der Update-Server sendet ein Antwortpaket, das mit folgenden Attributen am pvt-nat-gw-Gateway ankommt:
Quell-IP-Adresse: 192.168.2.2, die interne IP-Adresse des Update-Servers
Quellport: 80, die HTTP-Antwort vom Update-Server
Zieladresse: 10.1.2.2, entspricht der ursprünglichen NAT-Quell-IP-Adresse des Anfragepakets
Zielport: 34022, entspricht dem Quellport des Anfragepakets
Protokoll: TCP, unverändert
Das Gateway pvt-nat-gw führt DNAT für das Antwortpaket aus und schreibt die Zieladresse und den Zielport des Antwortpakets um, damit das Paket an die VM gesendet wird, die das Update angefordert hat, mit den folgenden Attributen:
Quell-IP-Adresse: 192.168.2.2, unverändert
Quellport: 80, unverändert
Zieladresse: 192.168.1.2, die interne IP-Adresse der VM
Zielport: 24000, entspricht dem ursprünglichen sitzungsspezifischen Quellport des Anfragepakets
[[["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-19 (UTC)."],[],[],null,["# Hybrid NAT\n==========\n\nHybrid NAT, a type of Private NAT,\nlets you perform network address translation (NAT) between\na Virtual Private Cloud (VPC) network and an on-premises\nnetwork or other cloud provider network. The non-Google Cloud network must be\nconnected to your VPC network by using Google Cloud's\nNetwork Connectivity products such as\n[Cloud Interconnect](/network-connectivity/docs/how-to/choose-product#cloud-interconnect)\nor [Cloud VPN](/network-connectivity/docs/how-to/choose-product#cloud-vpn).\n\nSpecifications\n--------------\n\nIn addition to the [general Private NAT specifications](/nat/docs/private-nat#pvt-nat-specs),\nHybrid NAT has the following specifications:\n\n- Hybrid NAT lets a VPC network communicate with an on-premises network or other cloud provider network even if the subnet IP address ranges of the networks overlap. By using a NAT configuration of `type=PRIVATE`, resources in both the overlapping and non-overlapping subnets of the VPC network can connect to resources in the non-overlapping subnets of the non-Google Cloud network.\n- To enable Hybrid NAT, the non-Google Cloud network must\n advertise its dynamic routes so that your VPC network can\n learn and use them. Your Cloud Router learns these dynamic routes\n from Google Cloud's Network Connectivity products such as\n Cloud Interconnect, HA VPN, or\n Classic VPN with dynamic routing configured. The destinations of\n these dynamic routes are IP address ranges outside of your VPC\n network.\n\n | **Note:** Only the non-overlapping subnet routes need to be advertised; overlapping subnet routes must not be advertised.\n\n Similarly, for return traffic, your VPC network must\n [advertise](/network-connectivity/docs/router/concepts/advertised-routes#overview-am)\n the Private NAT subnet route by using a Cloud Router,\n and this subnet route must not overlap with an existing subnet in the\n connected networks.\n- Hybrid NAT performs NAT on traffic originating from a\n VPC network to an on-premises network or other cloud\n provider network. The networks must be connected by\n Cloud Interconnect or Cloud VPN.\n\n- Hybrid NAT supports existing Classic VPN tunnels\n only if dynamic routing is enabled.\n\n- You need to create a custom NAT rule with a match expression\n `nexthop.is_hybrid`. The NAT rule specifies a NAT IP address range from a\n subnet of purpose `PRIVATE_NAT` that the resources in your VPC\n network can use to communicate with other networks.\n\n- The Cloud Router on which you configure Hybrid NAT\n must be in the same region as the VPC network.\n\n- The Cloud Router on which you configure Hybrid NAT\n can't contain any other NAT configuration.\n\nBasic Hybrid NAT configuration and workflow\n-------------------------------------------\n\nThe following diagram shows a basic Hybrid NAT configuration:\n[](/static/nat/images/hybrid-nat.svg) Hybrid NAT translation example (click to enlarge).\n\nIn this example, Hybrid NAT is set up as follows:\n\n- The `pvt-nat-gw` gateway is configured in `vpc-a` to apply to all the IP address ranges of `subnet-a` in the `us-east1` region.\n- Cloud Router and the on-premises or other cloud provider router exchange the following subnet routes:\n - Cloud Router advertises `10.1.2.0/29` to the external router.\n - The external router advertises `192.168.2.0/24` to Cloud Router.\n- By using the NAT IP address range of `pvt-nat-gw`, a virtual machine (VM) instance in `subnet-a` of `vpc-a` can send traffic to a VM in `subnet-b` of the on-premises network or other cloud provider network, even though `subnet-a` of `vpc-a` overlaps with another subnet in the non-Google Cloud network.\n\n### Example Hybrid NAT workflow\n\nIn the preceding diagram, `vm-a` with the internal IP address `192.168.1.2` in\n`subnet-a` of `vpc-a` needs to download an update from `vm-b` with the internal\nIP address `192.168.2.2` in `subnet-b` of an on-premises\nnetwork or other cloud provider network. Cloud Interconnect connects\nyour VPC network to the on-premises network or other cloud\nprovider network. Assume that the non-Google Cloud network contains\nanother subnet `192.168.1.0/24` that overlaps with the subnet in `vpc-a`.\nFor `subnet-a` of `vpc-a` to communicate with `subnet-b` of the\nnon-Google Cloud network, you need to configure a\nPrivate NAT gateway, `pvt-nat-gw`, in `vpc-a` as follows:\n\n- Specify a Private NAT subnet of purpose `PRIVATE_NAT`, for example, `10.1.2.0/29`. Create this subnet before configuring the Private NAT gateway. Ensure that this subnet does not overlap with an existing subnet in any of the connected networks.\n- Create a NAT rule with `match='nexthop.is_hybrid'`.\n- Configure the Private NAT gateway to apply to all IP address ranges of `subnet-a`.\n\nHybrid NAT follows the [port reservation procedure](/nat/docs/ports-and-addresses#port-reservation-procedure)\nto reserve the following NAT source IP address\nand source port tuples for each of the VMs in the network. For example, the\nPrivate NAT gateway reserves 64 source ports for `vm-a`:\n`10.1.2.2:34000` through `10.1.2.2:34063`.\n\nWhen the VM uses the TCP protocol to send a packet to the update server\n`192.168.2.2` on destination port `80`, the following occurs:\n\n1. The VM sends a request packet with these attributes:\n\n - Source IP address: `192.168.1.2`, the internal IP address of the VM\n - Source port: `24000`, the ephemeral source port chosen by the VM's operating system\n - Destination address: `192.168.2.2`, the update server's IP address\n - Destination port: `80`, the destination port for HTTP traffic to the update server\n - Protocol: TCP\n2. The `pvt-nat-gw` gateway performs source network address translation (SNAT or\n source NAT) on egress, rewriting the request\n packet's NAT source IP address and source port:\n\n - NAT source IP address: `10.1.2.2`, from one of the VM's reserved NAT source IP address and source port tuples\n - Source port: `34022`, an unused source port from one of the VM's reserved source port tuples\n - Destination address: `192.168.2.2`, unchanged\n - Destination port: `80`, unchanged\n - Protocol: TCP, unchanged\n3. The update server sends a response packet that arrives on the\n `pvt-nat-gw` gateway with these attributes:\n\n - Source IP address: `192.168.2.2`, the update server's internal IP address\n - Source port: `80`, the HTTP response from the update server\n - Destination address: `10.1.2.2`, which matches the original NAT source IP address of the request packet\n - Destination port: `34022`, which matches the source port of the request packet\n - Protocol: TCP, unchanged\n4. The `pvt-nat-gw` gateway performs destination network address translation\n (DNAT) on the response packet, and rewrites the response packet's destination\n address and destination port so that the packet is delivered to the VM that\n requested the update with the following attributes:\n\n - Source IP address: `192.168.2.2`, unchanged\n - Source port: `80`, unchanged\n - Destination address: `192.168.1.2`, the internal IP address of the VM\n - Destination port: `24000`, matching the original ephemeral source port of the request packet\n - Protocol: TCP, unchanged\n\nWhat's next\n-----------\n\n- Set up [Hybrid NAT](/nat/docs/set-up-private-nat).\n- Learn about [Cloud NAT product interactions](/nat/docs/nat-product-interactions).\n- Learn about [Cloud NAT addresses and ports](/nat/docs/ports-and-addresses).\n- Learn about [Cloud NAT rules](/nat/docs/nat-rules-overview).\n- Troubleshoot [common issues](/nat/docs/troubleshooting)."]]