aster.cloud aster.cloud
  • /
  • Platforms
    • Public Cloud
    • On-Premise
    • Hybrid Cloud
    • Data
  • Architecture
    • Design
    • Solutions
    • Enterprise
  • Engineering
    • Automation
    • Software Engineering
    • Project Management
    • DevOps
  • Programming
    • Learning
  • Tools
  • About
  • /
  • Platforms
    • Public Cloud
    • On-Premise
    • Hybrid Cloud
    • Data
  • Architecture
    • Design
    • Solutions
    • Enterprise
  • Engineering
    • Automation
    • Software Engineering
    • Project Management
    • DevOps
  • Programming
    • Learning
  • Tools
  • About
aster.cloud aster.cloud
  • /
  • Platforms
    • Public Cloud
    • On-Premise
    • Hybrid Cloud
    • Data
  • Architecture
    • Design
    • Solutions
    • Enterprise
  • Engineering
    • Automation
    • Software Engineering
    • Project Management
    • DevOps
  • Programming
    • Learning
  • Tools
  • About
  • Design
  • Engineering

Planning An IPv6 Network On Google Cloud

  • aster.cloud
  • February 19, 2023
  • 4 minute read

Google Cloud supports a wide range of IPv6 capabilities. When using IPv6 addressing, Google Cloud gives you the choice of using Global Unicast Addresses (GUA) for external connectivity or Unique Local Addresses (ULA) for private connectivity. In a previous blog, we discussed when and how to use ULA addressing for private communication in Google Cloud. In this blog, we discuss how to use Google Cloud’s GUA and ULA address space within your VPC network and customize it for your environment in a variety of interesting ways, with 4 billion IPv6 addresses available for each VM instance.

First, some context. Google Cloud reserves the fd20::/20 range for ULA address allocation and 2600:1900::/28 range for GUA address allocation (if you’re new to IPv6, here’s an overview of IPv6 addresses). Each Google Cloud VPC network consists of one or more subnets, which are regional resources that have IP address ranges associated with them. A dual-stack subnet is a resource that has both IPv4 and IPv6 address ranges associated with it. The IPv6 subnet size is /64 (e.g., fd20:a:b:c::/64). Each IPv6-enabled VM will be assigned a /96 address range from the subnet, providing 4 billion unique IPv6 addresses for each VM interface.


Partner with aster.cloud
for your next big idea.
Let us know here.



From our partners:

CITI.IO :: Business. Institutions. Society. Global Political Economy.
CYBERPOGO.COM :: For the Arts, Sciences, and Technology.
DADAHACKS.COM :: Parenting For The Rest Of Us.
ZEDISTA.COM :: Entertainment. Sports. Culture. Escape.
TAKUMAKU.COM :: For The Hearth And Home.
ASTER.CLOUD :: From The Cloud And Beyond.
LIWAIWAI.COM :: Intelligence, Inside and Outside.
GLOBALCLOUDPLATFORMS.COM :: For The World's Computing Needs.
FIREGULAMAN.COM :: For The Fire In The Belly Of The Coder.
ASTERCASTER.COM :: Supra Astra. Beyond The Stars.
BARTDAY.COM :: Prosperity For Everyone.

Please note that you can only configure a VPC network with dual-stack subnets only if the subnet mode is set to custom; IPv6 addressing is not available if the subnet mode is set to automatic. You can create a custom mode VPC network as follows:

gcloud compute networks create my-test-network --subnet-mode=custom

If you choose to use ULA addressing for your VPC network, Google Cloud allows you a choice between:

  • An automated allocation of a /48 address range for your VPC from the fd20::/20 range
gcloud compute networks create my-test-network --subnet-mode=custom --enable-ula-internal-ipv6
  • A /48 address range of your choice from the fd20::/20 range
gcloud compute networks create my-test-network --subnet-mode=custom --enable-ula-internal-ipv6 --internal-ipv6-range fd20:1:2:3::/48

Each /48 address range is automatically allocated across all GCP regions with portions of the /48 reserved for each region (e.g., /54 for us-central1, /55 for europe-west1, /56 for asia-south1). Subnets with a /64 prefix length are allocated from each of these regional reservations. This lets you create:

  • up to 256 subnets in a region where a /56 is automatically reserved
  • up to 512 subnets in a region where a /55 is automatically reserved
  • and up to 1024 subnets in a region where a /54 is automatically reserved.
Read More  Introducing Data Studio As Our Newest Google Cloud Service

The entire /48 is only available for your network, and is guaranteed not to overlap with any other network in GCP.

You can create a subnet with a ULA range associated with it:

gcloud compute networks subnets create my-test-subnet-2 \
  --network=my-test-network \
  --range=10.0.2.0/24 \
  --stack-type=IPV4_IPV6 \
  --ipv6-access-type=INTERNAL \
  --region=us-east4 \

You can create a VM with a ULA address for internal connectivity by associating it with a ULA subnet. A /96 is allocated to the VM on creation:

gcloud compute instances create my-test-vm-2 \
  --ipv6-network-tier PREMIUM \
  --subnet=my-test-subnet-2 \
  --stack-type=IPV4_IPV6

If you choose to use GUA addressing for your subnet, then a /64 is allocated for each subnet you create. GUA subnets are allocated from the 2600:1900::/28 address range:

gcloud compute networks subnets create my-test-subnet-1 \
  --network=my-test-network \
  --range=10.0.1.0/24 \
  --stack-type=IPV4_IPV6 \
  --ipv6-access-type=EXTERNAL \
  --region=us-east4 \

You can also create a VM with a GUA address for external connectivity by associating it with a GUA subnet. A /96 is allocated to the VM on creation:

gcloud compute instances create my-test-vm-1 \
  --ipv6-network-tier PREMIUM \
  --subnet=my-test-subnet-1 \
  --stack-type=IPV4_IPV6

By default, Google Cloud uses DHCPv6 to assign the first /128 address to the VM interface and creates Auto-DNS AAAA record for this first /128. However, Google Cloud provides you with the flexibility to use the 4 billion IPv6 addresses allocated to each VM interface by modifying the default configuration. Here are a few interesting things you can do with this capability:

  1. Create containers and embed their unique 32-bit container ids in the VM address range. For example: <VM 96-bit IPv6 range> <32-bit container id>. This allows the receiver of the traffic to recognize the sender by its container id.
  2. If you are building an application on Google Cloud, you can pass some metadata through network layers opaquely.
  3. For obfuscation purposes, use any random /128 IPv6 address from the /96 address range assigned.
  4. You can also encode information relevant to your environment such as location ID, using random bits from the last 32 bits.
  5. Finally, use suffix-based programming by using a well-known suffix to identify certain types of workloads.
Read More  Enabling Real-Time AI With Streaming Ingestion In Vertex AI

Example

Here’s an example of assigning unique IPv6 addresses to containers using network namespaces:

Consider a case where you have containers for your dev and prod environments running on a VM. If each environment is assigned an unique ID (lets say, the dev environment has ID=1 and the prod environment has ID=2), then the lower 32 bits of a VM can encode these IDs. You can then enforce ACLs such that the prod database can only accept connections with addresses whose lower 32 bits are ‘2’. This adds another level of security by providing environment isolation at the network layer.

# Create two network namespaces for dev and prod.
$ ip netns add dev
$ ip netns add prod

# Create virtual ethernet interfaces for namespaces.
$ ip link add veth-dev type veth peer name veth-prod
$ ip link set veth-dev netns dev
$ ip link set veth-prod netns prod

# Let's say the dev container has ID=1 and prod has ID=2. You can encode the ID of the environment in the lower 32 bits of VM address.
# Assign IPv6 address. Lets say dev environment has ID=1 and prod has ID=2

# Assign &lt;VM_IP::1&gt; to dev and &lt;VM_IP::2&gt; to prod
ip -n dev addr add fd20:aa:bb:cc:dd:ee::1/128 dev veth-dev
ip -n prod addr add fd20:aa:bb:cc:dd:ee::2/128 dev veth-prod

And with that, we hope that you now understand how to utilize the /96 address allocation to each VM in unique ways and customize it for your environment. To learn more about how to get started with IPv6 in Google Cloud, check out the documentation.

By: Rohit Dalal (Product Manager) and Ujjwal Jain (Software Engineer)
Source: Google Cloud Blog


For enquiries, product placements, sponsorships, and collaborations, connect with us at [email protected]. We'd love to hear from you!

Our humans need coffee too! Your support is highly appreciated, thank you!

aster.cloud

Related Topics
  • Google Cloud
  • Networking
  • Tutorials
You May Also Like
View Post
  • Engineering
  • Technology

Guide: Our top four AI Hypercomputer use cases, reference architectures and tutorials

  • March 9, 2025
View Post
  • Computing
  • Engineering

Why a decades old architecture decision is impeding the power of AI computing

  • February 19, 2025
View Post
  • Engineering
  • Software Engineering

This Month in Julia World

  • January 17, 2025
View Post
  • Engineering
  • Software Engineering

Google Summer of Code 2025 is here!

  • January 17, 2025
View Post
  • Data
  • Engineering

Hiding in Plain Site: Attackers Sneaking Malware into Images on Websites

  • January 16, 2025
View Post
  • Computing
  • Design
  • Engineering
  • Technology

Here’s why it’s important to build long-term cryptographic resilience

  • December 24, 2024
IBM and Ferrari Premium Partner
View Post
  • Data
  • Engineering

IBM Selected as Official Fan Engagement and Data Analytics Partner for Scuderia Ferrari HP

  • November 7, 2024
View Post
  • Engineering

Transforming the Developer Experience for Every Engineering Role

  • July 14, 2024

Stay Connected!
LATEST
  • college-of-cardinals-2025 1
    The Definitive Who’s Who of the 2025 Papal Conclave
    • May 7, 2025
  • conclave-poster-black-smoke 2
    The World Is Revalidating Itself
    • May 6, 2025
  • 3
    Conclave: How A New Pope Is Chosen
    • April 25, 2025
  • Getting things done makes her feel amazing 4
    Nurturing Minds in the Digital Revolution
    • April 25, 2025
  • 5
    AI is automating our jobs – but values need to change if we are to be liberated by it
    • April 17, 2025
  • 6
    Canonical Releases Ubuntu 25.04 Plucky Puffin
    • April 17, 2025
  • 7
    United States Army Enterprise Cloud Management Agency Expands its Oracle Defense Cloud Services
    • April 15, 2025
  • 8
    Tokyo Electron and IBM Renew Collaboration for Advanced Semiconductor Technology
    • April 2, 2025
  • 9
    IBM Accelerates Momentum in the as a Service Space with Growing Portfolio of Tools Simplifying Infrastructure Management
    • March 27, 2025
  • 10
    Tariffs, Trump, and Other Things That Start With T – They’re Not The Problem, It’s How We Use Them
    • March 25, 2025
about
Hello World!

We are aster.cloud. We’re created by programmers for programmers.

Our site aims to provide guides, programming tips, reviews, and interesting materials for tech people and those who want to learn in general.

We would like to hear from you.

If you have any feedback, enquiries, or sponsorship request, kindly reach out to us at:

[email protected]
Most Popular
  • 1
    IBM contributes key open-source projects to Linux Foundation to advance AI community participation
    • March 22, 2025
  • 2
    Co-op mode: New partners driving the future of gaming with AI
    • March 22, 2025
  • 3
    Mitsubishi Motors Canada Launches AI-Powered “Intelligent Companion” to Transform the 2025 Outlander Buying Experience
    • March 10, 2025
  • PiPiPi 4
    The Unexpected Pi-Fect Deals This March 14
    • March 13, 2025
  • Nintendo Switch Deals on Amazon 5
    10 Physical Nintendo Switch Game Deals on MAR10 Day!
    • March 9, 2025
  • /
  • Technology
  • Tools
  • About
  • Contact Us

Input your search keywords and press Enter.