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: