How to change an internal IP address
Written by
Updated at October 22, 2024
Scenario description
You need to change the internal IP address of the VM instance.
Solution
The internal address of the VM instance can be changed using CLI, Terraform, and API.
CLI
Terraform
API
- Installing and setting up the CLI
- The
yc compute instance update-network-interface
command.
Command example:
yc compute instance update-network-interface <VM ID> --network-interface-index=0 --ipv4-address=<new IP from subnet range>
The --network-interface-index
flag sets the index of the network interface being updated, with numbering starting from zero.
Note
You can only change the IP address on a stopped machine.