Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

3 Answers 3

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.

share|improve this answer
1  
The 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 5 '11 at 6:35
    
I shall edit my answer –  Lucas Kauffman Aug 6 '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.

share|improve this answer

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.