A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://cloud.google.com/compute/docs/ip-addresses/configure-static-internal-ip-address below:

Configure static internal IP addresses | Compute Engine Documentation

This page shows you how to configure and manage static internal IPv4 or IPv6 addresses for your Compute Engine virtual machine (VM) and bare metal instances.

If an instance requires a fixed internal IP address that does not change, you can obtain a static internal IP address for that instance by using one of the following options:

To learn how to manage secondary internal IP addresses, read Alias IP ranges.

In Compute Engine, each VM instance can have multiple network interfaces. Each interface can have one external IP address, one primary internal IP address, and one or more secondary internal IP addresses. To learn about IP addresses, read the IP addresses documentation.

With static internal IP addresses, you can always use the same IP address for a VM, even if you have to delete and recreate the VM.

To configure a static external IP address instead of an internal IP address, see Configure static external IP addresses.

Before you begin Required roles

To get the permissions that you need to configure and manage static IP addresses, ask your administrator to grant you the following IAM roles on your project:

For more information about granting roles, see Manage access to projects, folders, and organizations.

These predefined roles contain the permissions required to configure and manage static IP addresses. To see the exact permissions that are required, expand the Required permissions section:

Required permissions

The following permissions are required to configure and manage static IP addresses:

You might also be able to get these permissions with custom roles or other predefined roles.

Limitations How to configure a static internal IP address

You can reserve a static internal IP address, and then specify the reserved address when creating an instance. You can also create the VM with an ephemeral internal IP address and then promote that ephemeral IP address to a static internal IP address.

To use a static internal IP address, you must have a VPC network in place for your project. To view the VPC networks in your project, see View VPC networks.

Reserve a static internal IPv4 or IPv6 address and then associate it with a specific VM

In this scenario, you separately reserve a static internal IP address and then assign it to an instance:

  1. Choose a subnet in your VPC network. For IPv6 addresses, make sure that it is a subnet with an internal IPv6 address range.

  2. Reserve an internal IP address from the subnet's primary IP range. This step creates a named internal IP address resource that contains that specific internal IP address. Reserving the IP address prevents Google Cloud from automatically allocating that address as an ephemeral address.

  3. Use the reserved internal IP address by associating it with an instance when you create the VM resource.

Specify an ephemeral internal IPv4 or IPv6 address for an instance and then promote the address

In this scenario, you promote an ephemeral internal IPv4 or IPv6 address that is still attached to an instance:

  1. Choose a subnet in your VPC network. For IPv6 addresses, make sure that it is a subnet with an IPv6 address range.

  2. Create an instance with either an automatically allocated ephemeral IPv4 or IPv6 address or a custom IPv4 or IPv6 address.

  3. Promote the ephemeral internal IP address to a static address.

View available static internal IP addresses

To view all your existing static internal IP addresses, complete the following steps.

Console
  1. In the Google Cloud console, go to the IP addresses page.

    Go to IP addresses

  2. Click Internal IP addresses.

gcloud

Use the gcloud compute addresses list command:

gcloud compute addresses list
API

Use the addresses.list method:

GET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/addresses

Replace the following:

To list all the addresses in all regions, use the addresses.aggregatedList method:

GET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/aggregated/addresses
How internal IP addresses are assigned

The network interfaces for an instance are assigned IP addresses from the subnet that they are connected to. Each IPv4-only or dual-stack network interface has one primary internal IPv4 address that is assigned from the subnet's primary IPv4 range. Each IPv6-only or dual-stack network interface connected to a subnet with an internal IPv6 address range is assigned an internal IPv6 address.

Internal IPv4 addresses can be assigned in the following ways:

Internal IPv6 addresses can be assigned in the following ways:

Use reserved static internal IP addresses when creating resources

After you reserve a static internal IP address, you can assign the reserved address when creating an instance or an internal load balancer.

The following procedures describe how to use static internal IP addresses when creating resources:

Create an instance with a reserved internal IPv4 or IPv6 address

When you create an instance that is connected to a dual-stack or IPv6-only subnet with an internal IPv6 range, and you don't specify a custom ephemeral internal IPv6 address or reserved static internal IPv6 address, Compute Engine automatically assigns the instance an ephemeral internal IPv6 address from the subnet's IPv6 range.

Console
  1. In the Google Cloud console, go to the Create a VM instance page.

    Go to Create a VM instance

  2. Expand the Advanced options section.

  3. Expand the Networking section.

  4. To assign an internal IPv4 address, do the following:

    1. Select a network and a subnetwork.
    2. Select a reserved internal IPv4 address from the Primary internal IPv4 address list.

    Alternatively, select Reserve static internal IP address and reserve a new static internal IPv4 address.

  5. To assign an internal IPv6 address, do the following:

    1. Select a network that contains a subnet with an IPv6 address range.
    2. Select a dual-stack or IPv6-only subnet from the Subnetwork list. The subnet must have the INTERNAL IPv6 access type.
    3. For IP stack type, select IPv4 and IPv6 (dual-stack) or IPv6 (single-stack).
    4. Select a reserved internal IPv6 address from the Primary internal IPv6 address list.

    Alternatively, select Reserve static internal IPv6 address and reserve a new static internal IPv6 address.

  6. To finish modifying the default network interface, click Done.

  7. Continue with the instance creation process.

  8. Click Create.

gcloud REST

To create an instance with a static internal IP address, use the instances.insert method.

If you delete an instance with an ephemeral IP address, the address goes back into the unallocated address pool. If you need an internal IP address to persist beyond the life of the instance, you can reserve a static internal IP address.

Assign a static internal address to an instance's secondary network interface

When you create an instance with multiple network interfaces, you can use a reserved static internal IPv4 or IPv6 address for both primary and secondary network interfaces.

To use a static internal IPv4 or IPv6 address for a secondary network interface, see Create instances with multiple network interfaces.

Change or assign an internal IPv6 address to an existing instance

You can change or assign an internal IPv6 address for an existing dual-stack instance. If the instance is IPv4-only and you want to assign an IPv6 address, you must first change its stack type to dual-stack.

If the instance already has an internal IPv6 address assigned to it, you must first unassign that address. Then, assign a new address to the instance by using the instance's network interface.

Note: If you need to update the IP address of a forwarding rule, see Change the IP address of a forwarding rule.

To change or assign a static internal IPv6 address to an existing instance, complete the following steps.

Console
  1. Reserve a static internal IPv6 address.
  2. In the Google Cloud console, go to the VM instances page.

    Go to VM instances

  3. Click the name of the instance whose internal IPv6 address you want to change.

  4. On the Instance details page, complete the following steps:

    1. Click Edit.
    2. Expand Network interfaces.
    3. If the instance is IPv4-only and you want to assign an IPv6 address, you must first change the stack type to dual-stack.
    4. In the Primary internal IPv6 address list, do one of the following:
      • To automatically assign a new ephemeral IPv6 address, choose Ephemeral (Automatic).
      • To manually specify a new ephemeral IPv6 address, choose Ephemeral (Custom).
      • To assign an existing static internal IP address, choose the name of a reserved IPv6 address from the list.
    5. Click Done.
  5. Click Save.

gcloud

Use the compute instances network-interfaces update command.

gcloud compute instances network-interfaces update INSTANCE_NAME \
    --network-interface NIC \
    --ipv6-network-tier PREMIUM \
    --stack-type STACK_TYPE \
    --internal-ipv6-address INTERNAL_IPV6_ADDRESS \
    --zone ZONE

Replace the following:

REST

Use the instances.update method. Update the networkInterfaces[].ipv6Address property with the internal IPv6 address that you want to assign.

For example:

 POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/INSTANCE_NAME
  {
      ...
      "networkInterfaces": [{
          "accessConfigs": [{
              "type": "ONE_TO_ONE_NAT",
              "name": "External NAT",
          }],
          "stackType": "STACK_TYPE"
          "ipv6Address": "IPV6_ADDRESS",
          "internalIpv6PrefixLength": 96
          "subnetwork": "regions/REGION/subnetworks/SUBNETWORK",
      }],
      "disks": [{
          "autoDelete": "true",
          "boot": "true",
          "type": "PERSISTENT",
          "initializeParams": {
              "sourceImage": "projects/debian-cloud/global/images/debian-11-bullseye-v20241009"
          }
      }]
 }
 

Replace the following:

Manage static internal IP addresses

The following procedures let you manage static internal IP addresses for your instances:

Determine if an internal IPv4 or IPv6 address is ephemeral or static

Static and ephemeral internal IP addresses behave and appear the same in most contexts. However, with static internal IP addresses, you can use the same IP address for the same resource even if you delete and re-create the resource. In general, an ephemeral IP address is released if you stop or delete the resource.

To determine if an address is static or ephemeral, do the following:

  1. In the Google Cloud console, go to the IP addresses page.

    Go to IP addresses

  2. Find the address in the list and check the Type column for the type of IP address.

Unassign a static internal IPv6 address

You can unassign a static internal IPv6 address from a dual-stack instance by updating the stack type for the instance's network interface or by deleting the instance to which the address is assigned.

When you unassign an internal IPv6 address, the system removes it from the resource but keeps the address reserved for your project. You can later reassign the address to another resource.

To unassign a static internal IPv6 address from an instance, complete the following steps.

Console
  1. In the Google Cloud console, go to the VM instances page.

    Go to VM instances

  2. Click the name of the instance whose internal IPv6 address you want to unassign.

  3. On the Instance details page, complete the following steps:

    1. Click Edit.
    2. Expand Network interfaces.
    3. For IP stack type, select IPv4 (single-stack).
    4. Click Done.
  4. Click Save.

gcloud

Use the compute instances network-interfaces update command with the --stack-type flag set to IPV4_ONLY:

gcloud compute instances network-interfaces update INSTANCE_NAME \
    --network-interface=NIC \
    --stack-type=IPV4_ONLY \
    --zone=ZONE

Replace the following:

Check that your static internal IPv6 address is now available and marked as RESERVED instead of IN_USE:

gcloud compute addresses list \
    --filter="region=REGION AND name=INSTANCE_NAME"
REST

Update the instance stack type of the network interface where the internal IPv6 address is attached:

  1. Make a PATCH request to the instances.updateNetworkInterface method.
  2. In the request body, update the value of the stackType field to IPV4_ONLY.

    For example:

    PATCH https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/INSTANCE_NAME/updateNetworkInterface
    {
        "networkInterfaces": [{
            ...
            "stackType" : "IPV4_ONLY"
            ...
        }]
    }
    

    Replace the following:

Release a static internal IP address

If you no longer need a static internal IPv4 or IPv6 IP address, you can release the IP address by deleting the IP address resource. Deleting an instance doesn't automatically release a static external IP address. You must manually release static external IP addresses when you no longer require them.

To release a static internal IP address, see Release a static internal IPv4 or IPv6 address in the VPC documentation.

What's next

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4