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.
You may also need to change the
Works on Ubuntu (Guest VM):
sudo rm -f /etc/machine-id sudo dbus-uuidgen --ensure=/etc/machine-id sudo rm /var/lib/dbus/machine-id sudo dbus-uuidgen --ensure reboot
You can also try this parameter in the Ubuntu
netplan configuration file:
dhcp4: yes dhcp-identifier: mac
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.
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.
I got the same IP
10.0.2.15 VM's when I cloned Ubuntu on Mac.
To solve the issue I first shutdown the VM's.
Then for each VM
I select settings, then click Network tab, then changed attached to:
then I click advanced, select allow all for promiscuous mode,
finally refresh the MAC address to change the MAC address. Click Ok.
Now Start the VM's and you will get the different IP addresses.
192.168.0.14 for first and
192.168.0.15 for second. They were pingable from host Mac too.
Please read about available adapters in VirtualBox (https://www.virtualbox.org/manual/ch06.html#networkingmodes). If you want connection just between VMs then for your tests will be more suitable Internal Network adapter. However from you comment I get that you are using NAT.
I checked below scenario on VirtualBox 5.0.2 on host Mint 17.2 and guests Fedora 21:
Create main VM with default NAT adapter. Create Linked clone (https://www.virtualbox.org/manual/ch01.html#clone) with MACs reinitialization. Cloned and original VM have same values in file:
shows different MAC addresses on each one.
When I updated HWADDR in that file according to link/ether value from ip command and changed UUID with new one using
then despite the same IP on these (enp0s3) interfaces on original and cloned VMs, external network (Internet) was working well.