Score:0

Promote external IPv6 to static?

cn flag

What's the command for promoting an externally accessible IPv6 range to static within the VPC subnet?

My VM is accessible at 64bit wide IPv6 range, within a 96bit IPv6 subnet. But I'm afraid these may change without warning... this command seems like it should work:

gcloud compute addresses create myvm-6     --addresses "2600:abcd:abcd:abcd:0:0:0:0"     --region us-west2     --subnet neo-ipv6

ERROR: (gcloud.compute.addresses.create) Could not fetch resource:
 - Invalid value for field 'resource.address': '2600:abcd:abcd:abcd:0:0:0:0'. Requested IP is not within the range of subnetwork 'neo-ipv6'.
Donnald Cucharo avatar
nl flag
Hi OP, let us know if the answers helped.
Score:1
ar flag

You can only reserve two types of external IP Addresses. Global & Regional, IPv4 supports both but IPv6 only supports Global.

You cannot reserve IPv6 addresses for VM Instances since it only supports Global IP and can only be used for global load balancers as stated on the documentation.

To know more about Regional and global IP addresses check this link.

Score:0
pe flag

You can configure external IPv6 addresses on virtual machine instances (VMs) if the subnet that they are connected to has external IPv6 addresses enabled. Enabling external IPv6 addresses on a subnet is supported in some regions.

Create a VM and enable IPv6

You can create a VM with an external IPv6 address only if the subnet that you are connecting it to has external IPv6 addresses enabled.

gcloud compute instances create INSTANCE_NAME \
  --ipv6-network-tier=PREMIUM \
  --subnet=SUBNET_NAME \
  --stack-type=IPV4_IPV6 \
  --zone=ZONE

Replace the following:

INSTANCE_NAME: the name for the instance.

SUBNET_NAME: the subnet to connect the instance to. The subnet must have IPv6 enabled.

ZONE: the zone to deploy the instance in.

Promote an ephemeral external IP address

If your instance has an ephemeral external IP address and you want to permanently assign the IP to your project, promote the ephemeral external IP address to a static external IP address. Promoting an ephemeral external IP address to reserved does not cause Google Cloud to drop packets sent to the instance. This includes packets sent to the instance directly or by means of a load balancer.

To promote an ephemeral external IP address to a static external IP address, provide the ephemeral external IP address using the --addresses flag with the compute addresses create command. Use the region flag to promote an ephemeral regional IP address or the global flag to promote an ephemeral global IP address.


gcloud compute addresses create ADDRESS_NAME --addresses=IP_ADDRESS \
  [--region=REGION | --global]

Replace the following:

ADDRESS_NAME: the name you want to call this address

IP_ADDRESS: the IP address you want to promote

REGION: the region the regional IP address belongs to

--ip-version=IP_VERSION

Version of the IP address to be allocated and reserved. The default is IPV4.

IP version can only be specified for global addresses that are generated automatically (i.e., along with the --global flag, given --addresses is not specified) and if the --network-tier is PREMIUM.

IP_VERSION must be one of: IPV4, IPV6.

Check the references for more information:

Reserving a static external IP address

Configuring IPv6 for instances and instance templates

gcloud compute addresses create

Score:0
cn flag

Update: Global IP addresses cannot be assigned to instances... They can only be assigned to a short list of "Global Load Balancers". As of Dec 2021, the current API's do not feature any support for regionally static IPv6 addresses.

Your best bet is to assign a static IPv4 address and rely on 6to4 tunnels. Alternatively, you could use a DynDNS service or the Cloud DNS permission to manually update the address as needed.

Calculator: https://www.vultr.com/resources/ipv4-converter/


The current API's do not allow promotion of IPv6 addresses. So you'll need to enable the IPv6 stack for the instance, create a new regional IPv6 static IP and assign it to the instance by deleting the whole accessConfig and creating new one IPv6 one on nic0. IPv6 is only supported on nic0, so you'll likely need another nic for static IPv4 addresses.

# 0. create a new nic for your IPv4, this can have an IPv4 only subnet
# 1. delete the access config for nic0

# 2. Create global static regional IPv6
gcloud compute addresses create myip-2021 --ip-version=IPV6 --region=us-west2

# 2.1: That command will result in the following error:
ERROR: (gcloud.compute.addresses.create) Could not fetch resource:
 - IP Version is not supported for regional addresses.

# 3. Cry as you can't do the following
gcloud compute addresses list # This will list the new IPv6 address
gcloud beta compute instances add-access-config myinstancename --address="2001:abcd:0123::"
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.