VMware vSphere

 View Only
Expand all | Collapse all

Clone VM has same IP address

  • 1.  Clone VM has same IP address

    Posted Nov 22, 2018 11:57 AM

    Hello all,

    I have a lab environment at home running esxi 5.5. I went to clone my Server 2012 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?

    Thanks



  • 2.  RE: Clone VM has same IP address

    Posted Nov 22, 2018 12:28 PM

    "I copied" should have changed the MAC address.
    I would power off the VM, remove it from inventory , manually delete the MAC address parameters from the vmx-file and then re-register the VM.



  • 3.  RE: Clone VM has same IP address

    Posted Nov 22, 2018 01:09 PM

    I will try that and let you know.

    Thanks



  • 4.  RE: Clone VM has same IP address

    Posted Nov 23, 2018 11:44 AM

    Hi Continuum.

    Unfortunately that didn't work. So I did as instructed, removed it from inventory, downloaded the vmx file, edited the parameters by removing the lines following the link below. (note I deleted the lines but left the "  ") , uploaded the file back to the inventory and it's exactly the same.

    https://kabri.uk/2008/07/16/force-vmware-to-generate-a-new-mac-address/

    Did I do it right?

    How do I check if the VM is getting the address via dhcp from my physical router?



  • 5.  RE: Clone VM has same IP address

    Posted May 18, 2019 04:28 PM

    Or you could clone the VM, remove the nic and re-add it again. That should give the VM a new mac address. Another option is to clone the VM and then convert it into a template. Then create a new VM from that template. That should also work.



  • 6.  RE: Clone VM has same IP address

    Posted May 19, 2019 10:34 AM

    We bought a Dell server with VMWare ESXi 6.5 in 2017.

    I am very sure that the MAC-address are DIFFERENT between the original-VM and the cloned-VM.

    (I used

    vmkfstools -i "${PREFIX_DIR}/${FROM_VM}/${FROM_VM}_0.vmdk" "${PREFIX_DIR}/${TO_VM}/${TO_VM}_0.vmdk" -d thin

    sed "s/${FROM_VM}/${TO_VM}/g" "${PREFIX_DIR}/${FROM_VM}/${FROM_VM}.vmx" > "${PREFIX_DIR}/${TO_VM}/${TO_VM}.vmx"

    and clicked on "I copied the VM" to do the cloning.)

    However, it seems like something happened in VM-network and both VMs received same IP from the

    outside-DHCP-server.

    It's possible that we need to use vSphere to do this cloning-feature though~



  • 7.  RE: Clone VM has same IP address

    Posted May 20, 2019 05:01 AM

    Are you sure that the IP address is not set in the guest OS? You actually see two leases in the DHCP server? I find that hard to believe. Most DHCP servers have a mechanisme to detect duplicate IP addresses. So please check again that the guest OS is using DHCP and that you see the leases in the DHCP server.



  • 8.  RE: Clone VM has same IP address

    Posted May 21, 2019 02:15 AM

    The guestOS that I am running is 18.04.2.

    I am sure that the ip is assigned from the outside-DHCP-server.

    It looks like something happened in VMNet and the 2 VMs are considered as the same outside the VMWare ESXi.



  • 9.  RE: Clone VM has same IP address

    Posted May 21, 2019 02:59 AM

    I just tested on 16.04 as well.

    It looks the ip-allocation on 16.04 is perfectly great~

    but not on 18.04



  • 10.  RE: Clone VM has same IP address

    Posted May 21, 2019 05:03 AM

    The cause of the problem could be that the built-in network config of Ubuntu 18.04 no longer uses the NIC Mac address as the default id for DHCP requests.

    The traditional (and I believe "sensible") behavior can be restored by adding dhcp-identifier: macto the configuration in the /etc/netplan/xxx.yaml (cloud-init) file as follows:

    network: renderer: networkd version: 2 ethernets: nicdevicename: dhcp4: true dhcp-identifier: mac 

    Where "nicdevicename" is the name of your network device

    Use

    sudo netplan apply 

    to try the new configuration. If you get any errors, please note that precise indentation is very important in .yaml files..



  • 11.  RE: Clone VM has same IP address

    Posted Mar 04, 2021 11:17 AM

    This is the solution!!!

    Thanks for your contribution



  • 12.  RE: Clone VM has same IP address

    Posted Nov 23, 2018 11:57 AM

    Do an ipconfig /all and see if the DHCP Server IP address is the one from the router.



  • 13.  RE: Clone VM has same IP address

    Posted May 18, 2019 09:18 AM

    rightclix

    I encountered this question as well~

    I'm wondering did you find the solution?~

    I found that the mac-address of the VMs are displayed differently,

    and is also confirmed from ipconfig in the VM.

    However, somehow the IPs are assigned as the same.

    But the IPs are assigned as different if I create a new VM from scratch instead of cloning a VM.



  • 14.  RE: Clone VM has same IP address

    Posted Jan 02, 2024 01:39 AM

    Solution:

    Use these URLs below as the step-by-step solution (changing the

    /etc/netplan/config.yaml

     didn't work for me).

    But as said above, it's because of same machine-id.
    The URLs:
    1. https://kb.vmware.com/s/article/82229
    2. https://www.dtonias.com/create-vm-template-vmware-workstation/ (For creating a template of the VM)