Cloning is a convenient feature to create multiple same virtual machines. But if their IP addresses are all the same, too, it may cause IP conflict and affect the network access. If you find your cloned VM has same IP as the original, you can view this article to see how to prevent it from happening.
Hello all,
I have a lab environment at home running esxi 5.5. I went to clone my VM and syspreped it before hand. I selected the option 'I copied it' and proceeded to clone the VM, however I was expecting the clone vm to have a new mac address but it's exactly the same as the original with the same IP. (Note server is set to static ip) How do I safely change the IP address of the clone and is there a best practice method to clone a VM?
- Question from communities.vmware.com
You may run into the same situation as the above case, after VMware ESXi clone VM with or without vCenter Server, selected ‘I copied it’ option, only to find that the new VMs acquire the same DHCP IP addresses from the DHCP server, for example, ubuntu clone same IP address, no matter if guest customization is applied or not.
This often happens after cloning VMs that are running Ubuntu as guest operating system (OS) from VM template or a parent VM. In this article, I will introduce how to deal with the situation of cloned VM has same IP address.
Whether you are using host-only, network address translation (NAT), or bridged networking, each virtual machine must be assigned a unique IP address, dynamically or statically, as any regular computer. IP conflict can cause serious problems on the network. You may find that networking does not work in a cloned Linux virtual machine.
Although the cloning feature provided by hypervisors is supposed to prevent this from happening, there are still many people find their virtual machines created from template were fighting over the same IP address.
According to VMware, this issue often occurs when clone Ubuntu guest virtual machine. The newly cloned VM includes the same /etc/machine-id as the VM template or parent VM it was cloned from.
For Linux OS which uses /etc/netplan with default network renderer as systemd-networkd, such as Ubuntu Server 18.04, Ubuntu 19.10 and Ubuntu 20.04, the value of /etc/machine-id is used as a unique identifier when the DHCP server assigns an IP address for the Operating System. If two or more these guest OSes include the same /etc/machine-id, then they get the same IP addresses from the DHCP server.
In summary, the machine id is being used to request an IP address from DHCP, rather than the Mac address. That’s why even though each VM created from the standard template has a unique Mac address, they still assigned the same IP address from the DHCP server.
Currently there is no resolution to the problem that cloned VM has same IP address as the original VM. But luckily, there are still workarounds you can try to prevent this issue from happening.
To work around this issue, VMware recommends to prepare a VM template running an Ubuntu Guest OS with an empty /etc/machine-id, or alternatively, prepare a VM template explicitly setting the dhcp client identifier to mac.
Here are the specific steps:
1. Clone your VM template to a new VM.
2. Power on the new VM and run these commands inside the Linux Guest OS:
echo -n > /etc/machine-id rm /var/lib/dbus/machine-id ln -s /etc/machine-id /var/lib/dbus/machine-id
3. Re-clone the new VM to a new VM template.
Tip: When you are resolving VM network issues like cloned VM has same IP as original VM, you may want a handy way to check the VM IP addresses. In general, there are 4 common ways of how to check VM IP address. Take VMware vSphere as an example: 1. Check VM IP address on VMware vSphere web client with vCenter Server 2. Check VM IP address on VMware Host web client without vCenter Server 3. Get VM IP address via Windows PowerShell cmdlet 4. Get VM IP address from inside the VM via ifconfig
In fact, there is not just one way to clone a virtual machine. Except for vCenter Server, you can still clone your VMs via backup and restore tools. Here I recommend you AOMEI Cyber Backup, a professional backup software that capable of cloning VMs to new location with simple steps.
✦ Batch VM Backup: batch backup large numbers of VMs managed by vCenter Server or standalone ESXi hosts. ✦ Image-level independent Backup: create independent backups of VMware ESXi or Hyper-V VMs at image-level. ✦ Restore to New Location: you can restore VM backup to another data storage or host, and reset the RAM and Virtual Processor.
AOMEI Cyber Backup support both paid and free versions of VMware ESXi 6.0 and later versions, and also support Microsoft Hyper-V. Next I will demonstrate how to clone VM to new location on AOMEI Cyber Backup.
You can click the following button to start a 30-day free trial.
*You can choose to install this VM backup software on either Windows or Linux system.
1. Bind Devices: Access AOMEI Cyber Backup web client, navigate to Source Device > VMware > + Add VMware Device to add vCenter or Standalone ESXi host as the source device, and then click … > Bind Device.
Note: Once bound the host you do not need to repeat this step later.
2. Create Backup Task: Navigate to Backup Task > + Create New Task, and then set the Task Name, Backup Type, Device, Target, Schedule, and Cleanup according to your needs. Then click Start Backup.
The accomplished backup task will be listed in Backup Task.
3. Click ... > Restore on the backup task to open the wizard. Select Restore to new location option, specify the target host, data storage, and provide a name for the VM. Then click Start Restore to clone the VM to new location.
Note: You can also reset the RAM and Virtual Processor for the new VM.
Cloning is a convenient feature to create multiple same VMs on original host, or replicate VM to another host. In this article, I summarized the reason why cloned VM has same IP as original, and introduced how to prevent it from happening. Hope it could be helpful to you.
Except for the built-in cloning feature, you can try AOMEI Cyber Backup to clone VM in a backup and restore way. In addition, it also allows you to backup VMware VM to external hard drive for safer storage.