VMs from Template (and Clones, too) want to keep IP address of original/template

Discussion in 'Linux Guest OS Discussion' started by jorn, Jul 31, 2020.

  1. jorn

    jorn Bit Poster

    Messages:
    23
    What I'm trying to accomplish:
    Have a template of an Ubuntu server set up that I can clone, mostly for the purposes of building nodes for a small K8S cluster.
    I have Parallels Desktop for macOS Version 15.1.4 (47270)

    What I did:
    1. Built the template server, complete with patches, docker, etc. I named it Node01
    2. Shut down Node01
    3. Chose "Clone to template..."
    4. From that template, chose "Deploy to virtual machine..."

    What's wrong:
    A. Any new VM, despite even having a different MAC address, comes up with the same IP address as Node01. Why?
    B. I can force it to release [sudo dhclient -r enp0s5] and renew [sudo dhclient enp0s5] but when I reboot the VM, it's back to having the IP address of Node01. Why?? :eek:
     
    JeromeT3 likes this.
  2. DanS27

    DanS27 Bit Poster

    Messages:
    1
    Hi! I had the same issue, though I was working on Suse Enterprise Linux Server. The solution *seems* to work in line with other distributions of Linux:
    Code:
     
    prlctl clone <template_name> --name <new_vm_name>
    prlctl set <new_vm_name> --device-set net0 --ipadd <ip_address_predecided_by_me> # sets up VM to point to new IP address
    prlctl start <new_vm_name>
    # wait for VM to boot up
    prlctl exec <new_vm_name> rm /etc/udev/rules.d/70-persistent-net.rules # Resolves conflict between
    prlctl stop <new_vm_name>
    prlctl start <new_vm_name>
    You can verify it worked by looking at
    Code:
    cat /etc/hosts
    after the VM has booted up.

    I pieced together this solution from here and here

    Hope this helps!
     

Share This Page