I had an Ubuntu 10.4 VM running on another Ubuntu KVM host. I'd like to clone this VM but with a new IP address? I know that I would have to stop my VM, clone it, somehow give it a new IP address and then start both. How can I do so without having to SSH into the VM? Would I need to change any other parameters apart from the IP address?
3 Answers
When you have cloned that VM, BEFORE you turn it on. Mount the LVM of your clone to a folder and edit the /etc/network/interfaces in that folder.
Next unmount the LVM.
Start your machine.
profit.
- 16,818
- 9
- 57
- 92
-
1The problem with option 1 is that he would need to start the VM to log into the console, which would lead to an IP conflict on the network. Option 2 is best and the answer modded up for it. – Paul Aug 05 '11 at 06:35
-
I shall edit my answer – Lucas Kauffman Aug 06 '11 at 10:50
If you use a VM as a base image for other VMs, I would keep it as an non-active VM. Ie, you create the base image, make sure it works, then set the IP address to something you know and never use it again (the IP address or the image), except to create other VMs.
That way, when you need a new one, you can clone the base and fire it up knowing that the IP address won't conflict with anything. Then change its IP address during commissioning.
- 1,228
- 12
- 24
if you're cloning the VM you'd need more than just change the IP - drop all network configs, ssh keys, fqdn-tied certs etc.
in RHEL/Fedora this can be done using sys-unconfig
or by placing a file name .unconfigured in /
Maybe Ubuntu can do something similar
- 18,482
- 6
- 48
- 63