Create and use IPv6 sub-prefixes

This page describes how to divide your IPv6 public delegated prefix intosub-prefixes that you can assign to resources in specific projects. When youcreate a sub-prefix, your configuration includes a prefix length and a mode thatdetermines how the IP addresses can be used.

The following modes are supported:

  • For further delegation (--mode=DELEGATION): Sub-prefixes that you canfurther divide into smaller sub-prefixes. The associated IP addresses can'tbe assigned to resources until you create a non-delegation mode sub-prefix.

  • For forwarding rules (--mode=EXTERNAL_IPV6_FORWARDING_RULE_CREATION):Sub-prefixes that you can use as a source of regional externalglobal unicast address (GUA) ranges for forwarding rules. You choose aprefix length for the IPv6 addresses when you create the sub-prefix. Theforwarding rules can only be used for external passthrough Network Load Balancers and external protocolforwarding. Sub-prefixes in this mode can't be further delegated.

  • For external subnet ranges(--mode=EXTERNAL_IPV6_SUBNETWORK_CREATION): Sub-prefixes that you can useas a source of GUAs forexternalsubnet ranges. BYOIP-provided external subnet ranges can only be used byVM instances. Sub-prefixes in this mode can't be further delegated.

  • For internal subnet ranges(--mode=INTERNAL_IPV6_SUBNETWORK_CREATION): Sub-prefixes that you can useas a source of GUAs forinternalsubnet ranges. When assigned to an internal subnet range, GUAs are usedprivately and aren't advertised to the internet. Sub-prefixes in this modecan't be further delegated.

The different modes support different prefix sizes and IPv6 access types. Formore information, see the following section.

Sub-prefix mode configuration

The following table describesthe configuration settings and requirements for each sub-prefix mode.

Sub-prefix mode or settingPrefix length specificationsIPv6 access type
Sub-prefix for delegation
(--mode=DELEGATION)

Can be the same size or smaller (have a longer prefix length) than the parent public delegated prefix

The difference between the prefix length of a sub-prefix and its parent public delegated prefix can't be greater than 24

Valid lengths:/32,/40,/48,/56

  • External
  • Internal
Sub-prefix for external forwarding rules
(--mode=EXTERNAL_IPV6_FORWARDING_RULE_CREATION)

Can be the same size or smaller (have a longer prefix length) than the parent public delegated prefix

The difference between the prefix length of a sub-prefix and its parent public delegated prefix can't be greater than 24

Valid lengths:/32,/40,/48,/56,/64, or/72

  • External
Setting: External forwarding rule allocatable prefix length

Determines the prefix length for IPv6 address ranges that are used by external forwarding rules. Specified when creating an IPv6 sub-prefix for external forwarding rules.

Must be smaller than the associated sub-prefix—the difference between the allocatable prefix length and the sub-prefix length must be at least 8, and can't be greater than 32

Valid lengths:/48,/56,/64,/72,/80,/88,/96

Default lengths:

  • If the parent sub-prefix's length is/64 or/72, the default allocatable prefix length is/96
  • Otherwise, the default allocatable prefix length is/64
Sub-prefix for external subnet ranges
(--mode=EXTERNAL_IPV6_SUBNETWORK_CREATION)

Can be the same size or smaller (have a longer prefix length) than the parent public delegated prefix

The difference between the prefix length of a sub-prefix and its parent public delegated prefix can't be greater than 24

Valid lengths:/32,/40,/48,/56

  • External
Sub-prefix for internal subnet ranges
(--mode=INTERNAL_IPV6_SUBNETWORK_CREATION)

Can be the same size or smaller (have a longer prefix length) than the parent public delegated prefix

The difference between the prefix length of a sub-prefix and its parent public delegated prefix can't be greater than 24

Valid lengths:/32,/40,/48,/56

  • Internal

Sub-prefix delegation

IPv6 sub-prefixes that are in delegation mode can be sub-delegatedinto smaller sub-prefixes. This lets you assign the address blocks to differentprojects or regions. When you sub-delegate a sub-prefix, the following applies:

  • A public delegated prefix can besub-delegatedup to three times from a public advertised prefix.
  • IPv6 sub-prefixes can only be sub-delegated if they are in delegation mode.
  • Public delegated prefixes and sub-prefixes inherit theaccess type that you specifywhen you create a parent public advertised prefix.
  • The prefix length of a delegation mode sub-prefix affects thepossible modes of its child sub-prefixes. This is because a childsub-prefix must have a prefix length that is valid for its mode, andthe prefix length must be the same size as or smaller than its parent.

The following example demonstrates a multi-level delegation. Each step adheresto the prefix length and mode restrictions that are detailed in the sub-prefixmode table. If you have an external access public advertised prefixwith IP address range2001:db8::/32, you might do the following:

  1. From the parent public advertised prefix, you can create one or moretop-level public delegated prefixes. A top-level public delegated prefixcan be the same size or smaller than its parent public advertised prefix,and it must be in delegation mode. For this example, the entire IP addressrange of the parent prefix is delegated (2001:db8::/32).

  2. From the top-level public delegated prefix, you can create one or moresub-prefixes. A sub-prefix can be the same size as or smaller than itsparent public delegated prefix, and it can be in any mode that's compatiblewith its access type. For this example, another delegation modesub-prefix is created with IP address range2001:db8::/48.

  3. From the previous sub-prefix, you can create one or more sub-prefixes. Tomake the IP addresses available for resources, these prefixes must be in anon-delegation mode such as forwarding rule or subnet creation mode.For this example, two sub-prefixes are created: onefor external subnet ranges with IP address range2001:db8:0:0::/56 andone for external forwarding rules with IP address range2001:db8:1:0::/64.

At this point, you can't further divide the sub-prefixes that use the2001:db8:0:0::/56 or2001:db8:1:0::/64 ranges. A sub-prefix can't bedivided if it's in a non-delegation mode or if it already has three levelsof delegation from its parent public advertised prefix. In this example,both conditions are true.

Before you begin

  1. Create an IPv6public advertised prefix.
  2. Create an IPv6public delegated prefix.

Roles

To get the permissions that you need to complete the tasks in this guide, ask your administrator to grant you theCompute Public IP Admin (roles/compute.publicIpAdmin) IAM role on your project. For more information about granting roles, seeManage access to projects, folders, and organizations.

You might also be able to get the required permissions throughcustom roles or otherpredefined roles.

Create IPv6 sub-prefixes

When you create an IPv6 sub-prefix, all IP addresses in the sub-prefix are madeavailable; there is no reserved network address or broadcast address.

You can't change the mode of a sub-prefix. If needed, you candelete it and then recreateit. Before you can delete a sub-prefix, it must not be in use by anyresources.

You can't edit a sub-prefix to change its name. As a best practice,choose generic names that don't need to change—for example,sub-2001-db8-0-0-0-0-0-0-40, wheresub denotes the resource type and2001-db8-0-0-0-0-0-0-40 denotes the specific prefix and prefix length.

Console

  1. In the Google Cloud console, go toBring your own IP.

    Go to Bring your own IP

  2. Click the public delegated prefix that you want to subdivide.

  3. ClickCreate sub-prefix.

  4. Enter a name and optional description for the sub-prefix.

  5. In thePrefix length list, select a prefix length for thesub-prefix.

  6. Enter an IPv6 address range to assign to the sub-prefix.

  7. In theHow this PDP will be used section, do the following:

    • To create a sub-prefix for further delegation, selectSubdivide into smaller PDPs.
    • To create a sub-prefix with addresses that you can assign toresources, selectAllocate IPv6 address ranges for use, and thenspecify how you want to use the IP addresses:
      • For external forwarding rules forexternal passthrough Network Load Balancers and external protocol forwarding, selectExternal Network Load Balancer forwarding rule, and thenselect anAllocatable prefix length.
      • For external subnet ranges that can only host VMs, selectExternal subnet range for VMs.
      • For internal subnet ranges, selectInternal subnet range.
  8. In theProject menu, select the project that you want to use thesub-prefix in.

  9. ClickCreate.

gcloud

Use thegcloud compute public-delegated-prefixes create command.

gcloud compute public-delegated-prefixes createSUB_PREFIX_NAME \    --range=SUB_PREFIX_RANGE \    --mode=MODE \    --public-delegated-prefix=PDP_NAME \    --region=PDP_REGION \    --project=PROJECT_ID \    [--allocatable-prefix-length=PREFIX_LENGTH]

Replace the following:

  • SUB_PREFIX_NAME: a name for this sub-prefix

  • SUB_PREFIX_RANGE: the IP address range for thissub-prefix, in CIDR notation

  • MODE: themode for this sub-prefix,which must be one of the following:

    • DELEGATION
    • EXTERNAL_IPV6_FORWARDING_RULE_CREATION
    • EXTERNAL_IPV6_SUBNETWORK_CREATION
    • INTERNAL_IPV6_SUBNETWORK_CREATION

    The mode must be compatible with theaccess type of theparent public delegated prefix.

  • PDP_NAME: the parent public delegated prefix ofthis sub-prefix

  • PDP_REGION: the region for this sub-prefix

  • PROJECT_ID: the project to delegate the sub-prefixto

    If the--project flag is omitted, the sub-prefix iscreated in the same project as the parent public delegated prefix.

  • PREFIX_LENGTH: the prefix length for the IPv6 addressranges that are used by forwarding rules

    Only use this flag withEXTERNAL_IPV6_FORWARDING_RULE_CREATION mode.The default and possible values depend on the prefix length ofSUB_PREFIX_RANGE. For moreinformation, seeAllocatable prefix length for forwarding rules.

Assign IPv6 subnet ranges

You can assign external or internalIPv6 subnet ranges by using sub-prefixes.IPv6 subnet ranges that are created from a sub-prefix use global unicastaddresses (GUAs). The way that you can use the assigned rangedepends on the access type and mode of the sub-prefix:

  • External subnet ranges are assigned fromEXTERNAL_IPV6_SUBNETWORK_CREATION mode sub-prefixes. BYOIP-providedexternal subnet ranges can only beused to reserve static external IP addresses with theVM endpoint type andassign static or ephemeral external addresses to VM instances.

  • Internal subnet ranges are assigned fromINTERNAL_IPV6_SUBNETWORK_CREATION mode sub-prefixes. BYOIP-providedinternal subnet ranges are configured with privately used GUAsaren't advertised to the internet. The addresses can be used in the same wayas a Google-provided ULA internal subnet range.

Create subnets with IPv6 BYOIP ranges

When creating a new subnet, you can allocate anIPv6 address range from your sub-prefix.

Console

  1. In the Google Cloud console, go to theVPC networks page.

    Go to VPC networks

  2. To view theVPC network details page, click the name of a VPC network.

  3. On theSubnets tab, clickAdd subnet.In the panel that appears:

    1. Provide a name.
    2. Select a region.
    3. ForIP stack type, select eitherIPv4 and IPv6 (dual-stack)orIPv6 (single-stack).
    4. If you are creating a dual-stack subnet, enter an IPv4 range.
    5. ForIPv6 access type, select the access type of the sub-prefixthat you want to assign to the subnet.
    6. Select theFrom PDP checkbox.
    7. In thePDP list, select the sub-prefix to use for allocating IPaddresses to the subnet.
    8. Optional: Enter a specific IPv6 CIDR range to assign to the subnet.To let Google Cloud automatically selectan address block, skip this step.
    9. ClickAdd.

gcloud

Use thegcloud compute networks subnets create command.

gcloud compute networks subnets createSUBNET \    --network=NETWORK \    --stack-type=STACK_TYPE \    --ipv6-access-type=ACCESS_TYPE \    --region=REGION \    --ip-collection=PDP_NAME \    {--external-ipv6-prefix=EXTERNAL_IPV6_RANGE | --internal-ipv6-prefix=INTERNAL_IPV6_RANGE}    [--range=PRIMARY_IPv4_RANGE]

Replace the following:

  • SUBNET: a name for the new subnet
  • NETWORK: the name of the VPC networkthat will contain the new subnet
  • STACK_TYPE: the subnet's stack type

    The stack type can beIPV4_IPV6 orIPV6_ONLY. If you useIPV4_IPV6, you must specifya primary IPv4 range by using the--range flag.

  • ACCESS_TYPE: the access type of the sub-prefix thatyou're assigning to this subnet. EnterEXTERNAL to assign the subnetan external GUA subnet range. EnterINTERNAL to assign the subneta privately used internal GUA subnet range.

  • REGION: the Google Cloud region in which the newsubnet will be created, which must be the same region as this subnet'ssub-prefix

  • PDP_NAME: the name of an IPv6 sub-prefix inEXTERNAL_IPV6_SUBNETWORK_CREATION orINTERNAL_IPV6_SUBNETWORK_CREATIONmode to use for assigning IP addresses to this subnet

  • EXTERNAL_IPV6_RANGE orINTERNAL_IPV6_RANGE: an optional/64 IPv6 CIDRrange to assign to this subnet

    The range must be associated with thesubnet's sub-prefix. If empty, Google Cloud assigns the subnet arandom/64 range from the CIDR block of the associated sub-prefix.

  • PRIMARY_IPv4_RANGE: for dual-stack subnets, theprimary IPv4 range for the new subnet, in CIDR notation

Add an IPv6 BYOIP range to an IPv4-only subnet

You can change an IPv4-only subnet into a dual-stack subnet that uses anIPv6 address range from a sub-prefix.

Console

  1. In the Google Cloud console, go to theVPC networks page.

    Go to VPC networks

  2. Click the name of the VPC network that contains the subnetto update.

  3. ClickSubnets, and then click the name of the subnet to update.

  4. ClickEdit.

  5. In theIP stack type section, selectIPv4 and IPv6 (dual-stack).

  6. ForIPv6 access type, select the access type of the sub-prefixthat you want to assign to the subnet.

  7. Click theFrom PDP checkbox.

  8. In thePDP list, select the sub-prefix to use for allocating IPaddresses to the subnet.

  9. Optional: Enter a specific IPv6 address range to assign to the subnet.

  10. ClickSave.

gcloud

Use thegcloud compute networks subnets update command.

gcloud compute networks subnets updateSUBNET \    --ipv6-access-type=ACCESS_TYPE \    --stack-type=IPV4_IPV6 \    --ip-collection=PDP_NAME \    --region=REGION \    {--external-ipv6-prefix=EXTERNAL_IPV6_RANGE | --internal-ipv6-prefix=INTERNAL_IPV6_RANGE}

Replace the following:

  • SUBNET: a name for the new subnet
  • ACCESS_TYPE: the access type of the sub-prefix thatyou're assigning to this subnet. EnterEXTERNAL to assign the subnetan external GUA subnet range. EnterINTERNAL to assign the subneta privately used internal GUA subnet range.
  • PDP_NAME: the name of an IPv6 sub-prefix inEXTERNAL_IPV6_SUBNETWORK_CREATION orINTERNAL_IPV6_SUBNETWORK_CREATIONmode to use for assigning IP addresses to this subnet
  • REGION: the Google Cloud region in which the newsubnet will be created, which must be the same region as this subnet'ssub-prefix
  • EXTERNAL_IPV6_RANGE orINTERNAL_IPV6_RANGE: an optional/64 IPv6 CIDRrange to assign to this subnet

    The range must be associated with thesubnet's sub-prefix. If empty, Google Cloud assigns the subnet arandom/64 range from the CIDR block of the associated sub-prefix.

Deploy resources in subnets with IPv6 BYOIP ranges

After you create or update a subnet with a BYOIP-provided range, you candeploy resources that use the range's IP addresses.

For general information about assigning static and ephemeral IPv6 addressesto instances, seeConfigure IPv6 addresses for instances.

For information about assigning static external IPv6 addressesto VM instances, see the following:

For information about assigning internal IPv6 addresses to VM instances orforwarding rules, see the following:

Create external forwarding rules

You can use a sub-prefix that is inEXTERNAL_IPV6_FORWARDING_RULE_CREATIONmode to create forwarding rules with regional external IPv6 address ranges.The forwarding rules can only be used forexternal passthrough Network Load Balancers andexternal protocol forwarding.

For more information, see the following:

List prefixes

You can list all public advertised prefixes and public delegated prefixes(including sub-prefixes) in a project.

Console

  1. In the Google Cloud console, go toBring your own IP.

    Go to Bring your own IP

  2. All public advertised prefixes, public delegated prefixes, andsub-prefixes are displayed.

gcloud

To list public delegated prefixes, including sub-prefixes, use thepublic-delegated-prefixes listcommand.

gcloud compute public-delegated-prefixes list

What's next

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-02-19 UTC.