A RetroSearch Logo

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

Search Query:

Showing content from https://cloud.google.com/compute/docs/instances/migrating-interfaces-between-networks below:

Migrating a VM between networks | Compute Engine Documentation

Skip to main content Migrating a VM between networks

Stay organized with collections Save and categorize content based on your preferences.

This page describes how to migrate a VM instance from one network to another. In the case of a VM that is connected to more than one network using multiple network interfaces, this process updates one of the interfaces and leaves the rest in place.

The following migrations are supported:

In all cases, the VM stays in the region and zone where it was before. Only the attached network changes.

Before you begin Requirements

Before you migrate a VM, it must meet the following requirements:

Limitations Migrating a VM

Before you migrate a VM, review the requirements and limitations.

Google recommends that you create any necessary firewall rules, routes, load balancers, and other network infrastructure resources in the new network before migrating your VMs. Doing so can shorten the time that your VMs are offline.

Important: Migrating a VM can take several minutes. After you start migrating a VM, don't interrupt the process or modify any resources that Compute Engine is migrating.

To migrate a VM, select one of the following options:

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

    Go to VM instances

  2. Click the VM instance name to open the details page.

  3. If the VM is running, click stop Stop to stop the VM. If there is no Stop option, click more_vert More actions > stop Stop.

  4. After the VM stops, click Edit edit.

  5. Under Network interfaces, click the interface you want to move.

  6. In the Network field of the interface, select the new network for the interface.

  7. In the Subnetwork field of the interface, select the new subnet for the interface.

  8. In the Internal IP address field, specify Automatic if you want the system to allocate an IP address from the subnet range or Custom if you want to specify an unused one yourself.

  9. Click Done to close the network interface edit panel.

  10. Click Save.

  11. After the VM finishes saving, click Start start.

  12. If a confirmation dialog appears, click Start.

gcloud
  1. Stop the VM

    gcloud compute instances stop INSTANCE_NAME \
        --zone=ZONE_NAME

    where

  2. Migrate the VM

    gcloud compute instances network-interfaces update INSTANCE_NAME \
        --zone=ZONE_NAME \
        --network-interface=NIC \
        --network=NETWORK_NAME \
        --subnetwork=SUBNET_NAME

    where

  3. Start the VM

    Migration might take a few minutes, so wait before trying to start the VM in the new location.

    gcloud compute instances start INSTANCE_NAME \
        --zone=ZONE_NAME

    where

REST
  1. Stop the VM

    POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE_NAME/instances/INSTANCE_NAME/stop
    

    where

  2. View details for the instance.

    GET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE_NAME/instances/INSTANCE_NAME
    

    where

  3. Find the fingerprint for the interface.

    You need the fingerprint to update the network interface.

    Examine the output of the command and find the networkInterfaces field contents. Find the item with the name of the interface you would like to update (in a single-interface VM, the name is nic0). Copy the string in the fingerprint field in this item for use in the next step.

  4. Migrate the VM

    PATCH https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE_NAME/instances/INSTANCE_NAME/updateNetworkInterface?networkInterface=NIC
    {
      "network": NETWORK_NAME,
      "subnetwork": SUBNET_NAME,
      "networkIP": IP_ADDRESS,
      "name": NIC,
      "fingerprint": FINGERPRINT
    }
  5. Start the VM

    POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE_NAME/instances/INSTANCE_NAME/start
    

    where

What's next

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

Last updated 2025-08-07 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["This document explains how to migrate a Virtual Machine (VM) instance's network interface from one network to another, including legacy to VPC, VPC to VPC, subnet to subnet, and service project to shared network migrations, all while keeping the VM in its original region and zone."],["VM migration requires the VM to be stopped, and it cannot be part of a managed instance group (MIG), although VMs in unmanaged instance groups or Network Endpoint Groups (NEGs) can be migrated after being removed from the group, and VMs in target pools can be moved directly."],["During migration, the VM's MAC address will change, and the internal IP address might change if the target subnet has a different IP range, although you can choose to keep the old IP address if it is available in the new location or specify a new one."],["You can migrate a VM's network interface using the Google Cloud console, `gcloud` command-line tool, or the REST API, with each method requiring the VM to be stopped before starting the migration process."],["While migrating a VM interface, it is mandatory to not have the target network be a legacy network and for the user to create necessary firewall rules, routes, load balancers and other network infrastructure in the new network before migrating the VM."]]],[]]


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