0

when a Virtualbox instance is closed with save state, does the VirtualBox program/daemon still present the instance to the DHCP daemon as working, so that the current instance's IP address will be assigned to it - when the VB instance is revived again?

Example:

  1. VirtualBox instance [A] is assigned the IP address 192.168.1.1
  2. [A] is closed with "Save the machine state"
  3. [A] is started after a month

Will [A] IP address still be 192.168.1.1?

boardrider
  • 949
  • 2
  • 18
  • 29

2 Answers2

1

The client, of in this case that virtual machine, must renew the DHCP lease before it expires. Normally there is no VirtualBox daemon running when the VM isn't running.

On the practical side, it depends on how long your lease is. If is is more that a month, it might still be valid. Even if it is not, most DHCP servers will try to keep an address reserved that was once assigned, unless of course the address space is exhausted and it has to reuse expired addresses.

As you are using private addresses, you should use an address space that is large enough for all the virtual machines you want to create. Or you can get your DHCP server to assign fixed addresses for the machines where it is important to you. Or you configure fixed addresses in the VM.

RalfFriedl
  • 3,108
  • 4
  • 13
  • 17
0

No, this would be silly. The VM should recognize that the DHCP lease time has expired and start a DHCP request when it is started again.

If you need to have the machine keep the same address, assign it statically either in the VMs network configuration or in the DHCP server.

Sven
  • 98,649
  • 14
  • 180
  • 226
  • THanks, @Sven: can you elaborate (give URL) on "assign it statically either in the VMs network"? I don't think I've seen how to set a static address for a VirtualBox instance from VirtualBox. – boardrider Jul 25 '18 at 18:38
  • No, you set it up in the VM, not in VirtualBox. – Sven Jul 25 '18 at 18:41
  • From googling, I see that I need to set this static address in a Host-Only settings. But, my VirtualBox Instance (VM) needs to be defined as Bridged-Adapter. Is it possible to have both Host-Only and Bridged-Adapter. defined for the same VM? – boardrider Jul 25 '18 at 22:48