Dual stack networks IPv4 and IPv6 in Google Cloud

Ammett W
Google Cloud - Community
4 min readSep 6, 2022

--

An IP address is a unique identifier for a network and a host. IPv6 addresses were created to solve the problem of the address exhaustion limitation of IPv4. IPv4 is a 32 bit address which has a maximum address capability of 2(32) power = 4,294,967,296.

IPV6 address consists of 128 bits, divided into 16 bit hexadecimal fields. This address has the maximum address capability of 2(128) power = 340,282,366,920,938,463,463,374,607,431,768,211,456

Examples of IPv6 address formats can be seen in figure 1 below.

In the above example we have a global IPV6 address. This address is separated by a subnet into network and host segments.

  • Network portion — This represents the large single identified block space. Think of it as a street. This street can hold a little or many houses depending on the street size. The common factor would be the name of the street which would differentiate it from other streets.
  • The host portion — This represents the endpoint on the network. It is important to have unique addresses assigned to hosts to avoid conflicts. Imagine trying to deliver a letter to a recipient, but when the delivery person arrives on the street where the location exists, there are two houses with the same number. That would be a chaotic experience for both sender and receiver.

Virtual Private Cloud

A Virtual private Cloud is a global construct, which logically represents an on-premise data center. In your VPC you can provision networking, security, compute and storage resources for your environment. VPCs are attached to a project. When a project is created a default VPC is created.

Subnets in VPC
Subnets are regional and each subnet has to have a unique IP address range. Auto mode networks like the default network and the ones you can create are pre populated with IPv4 private address ranges for each region. You also have the ability to create custom VPC which are recommended for production since you can control the addressing assigned. IPv6 can be enabled on your custom mode VPC to allow communication. IPv6 currently operates in dual stack mode and we will go into more specifics later in this blog.

Where IPv6 is supported in Google Cloud
IPv6 can be assigned to the following

  • Virtual machines
  • Load balancers

Types of IPv6 addresses in Google Cloud

In Google Cloud there are two IPv6 access type modes you can configure for your subnets. Subnets can only be one of these and not both.

There are a few specific related to IPv6 addressing in Google Cloud. You can review the range assignments documentation for more.

Enabling dual stack on subnet

To enable dual stack IPv4/IPv6.

gcloud compute networks create NETWORK \
--subnet-mode=custom \
[ --enable-ula-internal-ipv6 [ --internal-ipv6-range=ULA_IPV6_RANGE ]] \
--bgp-routing-mode=DYNAMIC_ROUTING_MODE \
--mtu=MTU
gcloud compute networks subnets update SUBNET \
--stack-type=IPV4_IPV6 \
--ipv6-access-type=IPv6_ACCESS_TYPE \
--region=REGION
gcloud compute instance-templates create TEMPLATE_NAME \
--subnet=SUBNET \
--stack-type=IPV4_IPV6
--ipv6-network-tier=PREMIUM \
--region=REGION
--tags=TAGS
--image=IMAGE

Enabling IPv6 on Load balancer

Load balancer exposes services and load balance traffic to available resources. In addition to IPv4 you can use IPv6 IPs on your external load balancers.

IPv6 Load balancer termination

The document “IPv6 termination for External HTTP(S), SSL Proxy, and External TCP Proxy Load Balancing” gives you more detail on the process.

To see the configuration for IPv6 check out the Request routing to a multi-region external HTTPS load balancer documentation.

To learn more about IP addressing on Google Cloud, check the following links:

Want to ask a question, find out more or share a thought? Please connect with me on Twitter or Linkedin and send me a message.

--

--

Ammett W
Google Cloud - Community

DevRel Cloud Networking @ Google | Founder of Start Cloud Now | CCIE#43659, CISSP, AWS, GCP, Inspiring people as I go along my journey. Learn, Do your best.