Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I had one VM in my VirtualBox and wanted to use it as a template/image so I cloned it. Then I launched both the original and the clone simultaneously (to simulate a server cluster for something I was working on), however, both instances were assigned the same IP address. Is this perhaps a bug in our DHCP, which I think VirtualBox uses to get IP addresses? Or perhaps something in the way I set up my VMs? Anyway, I am ultimately interested in resolving this issue so that I can two VMs of the same image concurrently.

share|improve this question
    
On VMWare, if you started a previously used VM from a different path, it asked if you copied it or moved the VM to be able to avoid such situations... How did you clone the VM? –  ppeterka Oct 7 '13 at 20:51
    
i'm afraid this is not the situation here... –  amphibient Oct 7 '13 at 20:52
    
It is possible that you copied the machine with the MAC (Ethernet) address. That is one of differences between copying and moving in VMware as mentioned by ppeterka. Could you please check the addresses? Could you also please describe how exactly did you clone the machine? –  pabouk Oct 7 '13 at 21:12
    
yes, when i ran ifconfig -a, it showed the same MAC address for both (displayed as HWaddr) –  amphibient Oct 7 '13 at 21:34
    
but the way i cloned it was in UI, just right-clicked the VM and hit Clone –  amphibient Oct 7 '13 at 21:36

1 Answer 1

This is known as an IP conflict and can cause major headaches on the network.

You can re-initialize the MAC address of the cloned VM; that just means generate a new random one. On your cloned VM click Settings >> Network >> Advanced then click the two circular arrows to generate a new MAC. Your VM will need to be off. When it boots your DHCP server should assign the VM a different IP address.

Also FYI, when you cloned your VM you should have seen a checkbox with the words "reinitialize MAC", that would have cloned the VM and generated a new MAC instead of cloning it.

If you were curious, cloning a VM is often used to make a full backup of the VM, in this case you would want the MAC and IP to be the same in case you had to use the backup. For your case of cloning the VM to build a cluster you'll want to re-initialize the MAC on every clone.enter image description here

Update 1 In response to your comments from 10/8/2013.

Make sure the IP address is not statically set. You mentioned in your question that the VM should be getting it's IP from DHCP. If thats the case the config should look something like the following. For debian based systems it will be found at /etc/network/interfaces

auto eth0
iface eth0 inet dhcp

For redhat based systems the networking configuration is at /etc/sysconfig/network-scripts/ifcfg-eth0

Your second comment mentioned that eth0 is missing. Do you have an eth1? Since your computer changed mac addresses, the OS keeps the original mac as eth0 and usually assigns eth1 to the new mac. To reset the eth* devices so you have an eth0 and not an eth1 you'll need to clear the udev networking rules.

Messing with networking can get hairy. One option would be to delete your cloned VM and clone the original again and check "reinitialize mac". I'm not certain it will fix your problem but it might.

share|improve this answer
    
I did that and restarted both VMs but they were still assigned the same IP :( –  amphibient Oct 8 '13 at 14:39
    
the clone does not have eth0 when i run ifconfig –  amphibient Oct 8 '13 at 14:42
    
I updated my answer to address the issues you wrote about in the comments. –  tbenz9 Oct 9 '13 at 18:09
    
@amphibient, I re-created your problem and was able to solve it easily by deleting everything out of the /etc/udev/rules.d/70-persistent-net.rules file and rebooting. Good luck! –  tbenz9 Oct 10 '13 at 4:58

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.