[SOLVED] Change a cloned VM:s network config before booting first time

holmis

Member
Aug 14, 2023
11
1
8
I'm sure this has been asked before (sorry)...

Is there a way to change the static IP of a cloned (Linux/Debian) VM before booting it for the first time?

The reason I'm asking is that sometimes there is a need to do some testing and the easiest way would be to clone the running VM. However, since the running VM has at static IP address, just by starting the cloned VM there will be an IP number conflict...
 
Is there a way to change the static IP of a cloned (Linux/Debian) VM before booting it for the first time?
The address is configured inside the VM, right?

You could mount the virtual disk on the host and manipulate the configuration from there.

What I do is this: for the cloned VM go to Hardware --> Network Device --> Edit. There is a "Disconnect [x]" checkbox. Check it ;-)

Now you can start this new VM without triggering an address conflict - it just has "no connection". Start it, use the PVE --> VM --> Console to login and edit the settings.

You can deselect the "Disconnect" option on-the-fly, no reboot required.
 
What I do for this is: Create a VM template that includes a Cloud-Init drive. Then each time make a full-clone & then you can edit the NW settings (amongst others) within the GUI in the Cloud-Init section of the new VM before booting. Finally, after booting it up, remove the Cloud-Init drive for the new VM.
 
  • Like
Reactions: UdoB and leesteken