Private NAT for NCC spokes (original) (raw)

Private NAT lets you create a Private NAT gateway that works in conjunction with Network Connectivity Center spokes to perform network address translation (NAT) between the following networks:

Specifications

In addition to the general Private NAT specifications, Private NAT for NCC spokes has the following specifications:

Traffic between VPC networks

The following additional specifications apply for traffic between VPC networks (Inter-VPC NAT):

Traffic between VPC networks and other networks

The following additional specifications apply for traffic between VPC networks and networks outside of Google Cloud:

For information about the requirements for using VPC spokes and hybrid spokes in the same NCC hub, seeRoute exchange with VPC spokes.

Basic configuration and workflow

The following diagram shows a basic Private NAT configuration for traffic between two VPC spokes:

Inter-VPC NAT translation example.

Inter-VPC NAT translation example (click to enlarge).

In this example, Private NAT is set up as follows:

Example workflow

In the preceding diagram, vm-a with the internal IP address 192.168.1.2 insubnet-a of vpc-a needs to download an update from vm-b with the internal IP address 192.168.2.2 in subnet-b of vpc-b. Both the VPC networks are connected to the same NCC hub as VPC spokes. Assume that vpc-b contains another subnet 192.168.1.0/24 that overlaps with the subnet in vpc-a. For subnet-a of vpc-a to communicate with subnet-bof vpc-b, you need to configure a Private NAT gateway, pvt-nat-gw, in vpc-a as follows:

The following table summarizes the network configuration specified in the preceding example:

Network name Network component IP address/range Region
vpc-a subnet-a 192.168.1.0/24 us-east1
vm-a 192.168.1.2
pvt-nat-gw 10.1.2.0/29
vpc-b subnet-b 192.168.2.0/24 us-west1
vm-b 192.168.2.2
subnet-c 192.168.1.0/24
vm-c 192.168.1.3

Private NAT for NCC spokes follows theport reservation procedureto reserve the following NAT source IP address and source port tuples for each of the VMs in the network. For example, the Private NAT gateway reserves 64 source ports for vm-a:10.1.2.2:34000 through 10.1.2.2:34063.

When the VM uses the TCP protocol to send a packet to the update server192.168.2.2 on destination port 80, the following occurs:

  1. The VM sends a request packet with these attributes:
    • Source IP address: 192.168.1.2, the internal IP address of the VM
    • Source port: 24000, the ephemeral source port chosen by the VM's operating system
    • Destination address: 192.168.2.2, the update server's IP address
    • Destination port: 80, the destination port for HTTP traffic to the update server
    • Protocol: TCP
  2. The pvt-nat-gw gateway performs source network address translation (SNAT or source NAT) for egress traffic, rewriting the request packet's NAT source IP address and source port:
    • NAT source IP address: 10.1.2.2, from one of the VM's reserved NAT source IP address and source port tuples
    • Source port: 34022, an unused source port from one of the VM's reserved source port tuples
    • Destination address: 192.168.2.2, unchanged
    • Destination port: 80, unchanged
    • Protocol: TCP, unchanged
  3. The update server sends a response packet that arrives on thepvt-nat-gw gateway with these attributes:
    • Source IP address: 192.168.2.2, the update server's internal IP address
    • Source port: 80, the HTTP response from the update server
    • Destination address: 10.1.2.2, which matches the original NAT source IP address of the request packet
    • Destination port: 34022, which matches the source port of the request packet
    • Protocol: TCP, unchanged
  4. The pvt-nat-gw gateway performs destination network address translation (DNAT) on the response packet, rewriting the response packet's destination address and destination port so that the packet is delivered to the VM that requested the update with the following attributes:
    • Source IP address: 192.168.2.2, unchanged
    • Source port: 80, unchanged
    • Destination address: 192.168.1.2, the internal IP address of the VM
    • Destination port: 24000, matching the original ephemeral source port of the request packet
    • Protocol: TCP, unchanged

What's next