Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
    • Yandex Cloud Partner program
  • Blog
  • Pricing
  • Documentation
© 2025 Direct Cursus Technology L.L.C.
Yandex Compute Cloud
    • All guides
      • Stopping and starting a VM
      • Resetting a Windows Server VM user password
      • Attaching a disk to a VM
      • Detaching a disk from a VM
      • Moving a VM to a different availability zone
      • Moving a VM to a different folder
      • Moving a VM to a different cloud
      • Adding another network interface to a VM
      • Deleting a network interface from a VM
      • Assigning a public IP address to a VM
      • Unassigning a public IP address from a VM
      • Making a VM public IP address static
      • Reassigning a public IP address from one VM to another
      • Updating the VM internal IP address
      • Updating a VM
      • Changing VM computing resources
      • Changing VM security groups
      • VM maintenance policy management
      • Configuring VM access permissions
      • Linking a service account to a VM
      • Deleting a VM
    • Viewing operations with resources
  • Yandex Container Solution
  • Access management
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Release notes
  1. Step-by-step guides
  2. Managing a VM
  3. Updating the VM internal IP address

Updating the VM internal IP address

Written by
Yandex Cloud
Updated at May 5, 2025

After you create a VM, you can update internal IP addresses of its network interfaces.

CLI
Terraform
API

If you do not have the Yandex Cloud CLI yet, install and initialize it.

The folder specified when creating the CLI profile is used by default. To change the default folder, use the yc config set folder-id <folder_ID> command. You can specify a different folder using the --folder-name or --folder-id parameter.

  1. See the description of the CLI command for updating the internal IP address of a VM network interface:

    yc compute instance update-network-interface --help
    
  2. Get a list of VMs in the default folder:

    yc compute instance list
    

    Result:

    +----------------------+-----------------+---------------+---------+----------------------+
    |          ID          |       NAME      |    ZONE ID    | STATUS  |     DESCRIPTION      |
    +----------------------+-----------------+---------------+---------+----------------------+
    | fhm0b28lgfp4******** | first-instance  | ru-central1-a | RUNNING | my first vm via CLI  |
    | fhm9gk85nj7g******** | second-instance | ru-central1-a | RUNNING | my second vm via CLI |
    +----------------------+-----------------+---------------+---------+----------------------+
    
  3. Select ID of the VM in question.

  4. Stop the selected VM.

  5. Get a list of network interfaces for the VM by specifying its ID:

    yc compute instance get <VM_ID>
    

    Result:

    ...
    network_interfaces:
      - index: "0"
        mac_address: d0:0d:24:**:**:**
        subnet_id: e2lpp96bvvgp********
        primary_v4_address:
          address: 192.168.2.23
          one_to_one_nat:
            address: 158.160.**.***
            ip_version: IPV4
      - index: "1"
        mac_address: d0:1d:24:**:**:**
        subnet_id: e2lrucutusnd********
        primary_v4_address:
          address: 192.168.1.32
      - index: "2"
        mac_address: d0:2d:24:**:**:**
        subnet_id: e2lv9c6aek1d********
        primary_v4_address:
          address: 192.168.4.26
    ...
    

    Save the index field value, which is the number of the network interface you want to update the internal IP address for.

  6. Update the internal IP address of the selected VM network interface:

    yc compute instance update-network-interface \
      --id <VM_ID> \
      --ipv4-address <internal_IP_address> \
      --network-interface-index <network_interface_number>
    

    Where:

    • --id: VM ID.
    • --ipv4-address: Internal IP address. Specify a new IP address or enter auto to assign it automatically.
    • --network-interface-index: VM network interface number you saved earlier.

With Terraform, you can quickly create a cloud infrastructure in Yandex Cloud and manage it using configuration files. These files store the infrastructure description written in HashiCorp Configuration Language (HCL). If you change the configuration files, Terraform automatically detects which part of your configuration is already deployed, and what should be added or removed.

Terraform is distributed under the Business Source License. The Yandex Cloud provider for Terraform is distributed under the MPL-2.0 license.

For more information about the provider resources, see the documentation on the Terraform website or mirror website.

If you do not have Terraform yet, install it and configure its Yandex Cloud provider.

  1. To update the internal IP address of a VM network interface, add the ip_address parameter to the network_interface section of the network interface you need in the yandex_compute_instance resource configuration:

    resource "yandex_compute_instance" "vm-1" {
      ...
      network_interface {
        ...
        ip_address = "<internal_IP_address>"
      }
    }
    

    For more information about the yandex_compute_instance resource parameters, see the relevant provider documentation.

  2. Create the resources:

    1. In the terminal, change to the folder where you edited the configuration file.

    2. Make sure the configuration file is correct using the command:

      terraform validate
      

      If the configuration is correct, the following message is returned:

      Success! The configuration is valid.
      
    3. Run the command:

      terraform plan
      

      The terminal will display a list of resources with parameters. No changes are made at this step. If the configuration contains errors, Terraform will point them out.

    4. Apply the configuration changes:

      terraform apply
      
    5. Confirm the changes: type yes in the terminal and press Enter.

    Terraform will create all the required resources. You can check the new resources using the management console.

To update the internal IP address of a VM network interface, use the updateNetworkInterface REST API method for the Instance resource or the InstanceService/PrimaryAddress gRPC API call.

Was the article helpful?

Previous
Reassigning a public IP address from one VM to another
Next
Updating a VM
© 2025 Direct Cursus Technology L.L.C.