0

I had a problem with vms that lose their previous ip after system restart, so after some time it will go from x.x.x.128 to x.x.x.136 etc. Short of switching to static ip, I had to resort to resetting dhcp ip address pool: Reset DHCP IPs to beginning of range

I also found a better workaround from https://serverfault.com/a/381137, which works by configuring dhclient (which Network Manager uses to manage dhcp by default) to request a specific address for a particular interface:

interface "eth0" {
    send dhcp-requested-address 192.168.1.222;
}

Now, we know for sure that the original address of x.x.x.128 is not used by any other machine, since the vm guest is the only machine on that virtual network (apart from the host machine). Even though an address change was triggered for the vm guest, can dhcp be configured to assign x.x.x.128 if it is still unused?

  • In this case, the requested DHCP server is a part of the virtualization program. Please tell us which one do you use. – Melebius Sep 27 '16 at 7:19
  • @Melebius it is vmware – prusswan Sep 27 '16 at 7:19
  • This is an XY problem - Ask a question about "vms that lose their previous ip after system restart". Changing a DHCP server to assign addresses sequentially is a source-level change. - Not the way to go for simply debugging a problem. – waltinator Sep 27 '16 at 13:01
  • which dhcp server are you using? As far as my experience goes, isc-dhcp-server will always give the same clients the same IP address just so long as it is available when they request it. – Doug Smythies Sep 27 '16 at 15:03
  • 1
    Then my suggestion is that you use a full isc-dhcp-server and get your VM's to use it. My VM's are all on my main LAN (bridged) and all get their IP address from my main DHCP server, which resides on a different Ubuntu server (but it doesn't have to). – Doug Smythies Sep 27 '16 at 15:43
0

As suggested by Melebius, the dhcp server in my scenario is not actually in the Ubuntu instance (vm guest) - it was simply a virtualized component (or "part of the virtualization program") on the host machine, with some configurable options. Even if I could configure it, it would have been independent of Ubuntu.

Hence, the workaround using dhcp-requested-address with dhclient seems to be the best option in this situation, with minimal change to a default installation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.