VBox DHCP exhaust IPs

Discussions related to using VirtualBox on Linux hosts.
JJon
Posts: 18
Joined: 3. Nov 2016, 11:54

VBox DHCP exhaust IPs

Post by JJon »

Hi,

I'm using VBox 5.1.8 on ubuntu 14.04.
I configured a NAT Netwrok type with DHCP for a VM which I regularly clone ("linked clone") from.
The cloned VMs are short lived, meaning they are destroyed after several minutes.

Everything works fine up until the last IP provided by the DHCP server (10.0.2.254).
Even though all the VMs are destroyed (even after 2 weeks), the DHCP doesn't assign IPs anymore to any of the new VMs cloned.
It seems like it doesn't return any of the destroyed IPs to the pool.

I couldn't find any way of making the DHCP server ignore the previous IPs and return them back to the pool of IPs.
I don't think it relates to the "lease time" since even after 2 weeks of no VMs, it still happens.

Any known issue about this?

Thanks,
Jonathan
sparko
Posts: 5
Joined: 29. Nov 2017, 15:44

Re: VBox DHCP exhaust IPs

Post by sparko »

Hi, have you solved the issue? I'm meeting the same now.
socratis
Site Moderator
Posts: 27330
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: VBox DHCP exhaust IPs

Post by socratis »

@sparko
This is not solvable. Do you mind explaining your problem in detail with more than 140 characters? This is not Twitter, you can expand your thoughts ;)
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
sparko
Posts: 5
Joined: 29. Nov 2017, 15:44

Re: VBox DHCP exhaust IPs

Post by sparko »

I think the issue is properly described by first @JJon post. I can provide more info, but I don't know what. What else do you need to know?
socratis
Site Moderator
Posts: 27330
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: VBox DHCP exhaust IPs

Post by socratis »

If for example you are constantly launching VMs that require a different IP address each time. I asked you for your usage scenario, because the usage of the OP is a rather rare one.

In any event, the timeout of the DHCP lease is not a couple of sec/min so that you can launch VMs constantly. If you run into this problem, then quit and restart VirtualBox. A DHCP server cannot serve an infinite number of clients and once an IP is allocated the timeout for the lease has to happen before that IP is freed. That's how it works in real life™.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
sparko
Posts: 5
Joined: 29. Nov 2017, 15:44

Re: VBox DHCP exhaust IPs

Post by sparko »

Issue is, that lease time seems not working. I think it's hardcoded 20 minutes in virtualbox DHCP, but after a much longer time after VM with some particular IP was deleted, it is still not assigned to the new VM so you end up stuck with no IP.

I run automated tests in virtualbox. I have jenkins instance that run VMs and execute tests on it. So VMs are very short lived and IPs exhaust in few days as I used just 100-250 range. I don't want to involve manual steps, like restarting virtualbox, to the process.
socratis
Site Moderator
Posts: 27330
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: VBox DHCP exhaust IPs

Post by socratis »

No way around it at the moment I'm afraid. Restarting VirtualBox after a couple of days seems like a reasonable workaround at the moment. Unless you want to build your own VirtualBox from the source.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
sparko
Posts: 5
Joined: 29. Nov 2017, 15:44

Re: VBox DHCP exhaust IPs

Post by sparko »

That's what I expected. Isn't it clearly a bug in Vbox's DHCP server? Is it reported?

Unfortunately, restarting vbox service is not solution for me. My workaround is to have forever-running VM with static IP that has DHCP server installed and turn off vbox's DHCP. This works well and is not overhead for me as I need that VM to run other services...
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: VBox DHCP exhaust IPs

Post by mpack »

Yes it sounds like a bug, so I suggest raising a BugTracker ticket for the problem. The bug sounds trivial to me, if so it should be an easy fix to reuse IPs once the address space is exhausted, and/or increase the lease time.

Btw, the ticket should say "NAT DHCP", not "VBox DHCP", as VirtualBox has several different DHCP services.

You should also provide a link to this discussion, and the devs do insist on having a zipped log file attached to the ticket (or to this discussion, linked from the ticket).
Martin
Volunteer
Posts: 2560
Joined: 30. May 2007, 18:05
Primary OS: Fedora other
VBox Version: PUEL
Guest OSses: XP, Win7, Win10, Linux, OS/2

Re: VBox DHCP exhaust IPs

Post by Martin »

You could check the public bugtrackerif a ticket already exists.
If not you could open a new one there.
sparko
Posts: 5
Joined: 29. Nov 2017, 15:44

Re: VBox DHCP exhaust IPs

Post by sparko »

mpack wrote: Btw, the ticket should say "NAT DHCP", not "VBox DHCP", as VirtualBox has several different DHCP services.
Oh, my issue is for host-only network. Now I've noticed that original issue is with NAT. I guess the root cause will be the same. I'll definitely mention that in bug report.
socratis
Site Moderator
Posts: 27330
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: VBox DHCP exhaust IPs

Post by socratis »

This is definitely *not* a bug, since every other DHCP server on the planet works the same way. I urge you to find a DHCP server that has less than 20 min of a lease time. On my LAN, my two wireless access points have a 4 hour minimum lease, and the main router has a 24 hour lease; those are the defaults, the min are 20 min on both of them. And no, a DHCP server cannot reuse IPs if they're not in use, unless the lease time has expired (that's the whole point). If that was the case, my computer going to sleep would lose its IP. Not a great idea.

What you're asking for is an *enhancement* to the VirtulBox DHCP server(s) to have a limited, settable, DHCP lease time. Instead of the hardcoded 20 min, you would like a settable lease time, because your usage pattern is extraordinary.

So, please do not baptize this as a bug. It's not one...

PS. Please post the ticket number here, if you create one...
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: VBox DHCP exhaust IPs

Post by mpack »

Sparko seemed to me to be reporting that the IP address is not made available for reuse after the lease time expires. If that is correct then it's a bug.

There also seemed to be an implication that the DHCP servers starts at the bottom of its configured IP address range, and count up with each new assignment, but it never loops around to the first address again to reuse expired addresses. If correct then that would be a bug too.
socratis
Site Moderator
Posts: 27330
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: VBox DHCP exhaust IPs

Post by socratis »

Actually the issue of expired leases never came up. What 'JJon' (the OP) and 'sparko' are doing, are to create short-lived VMs and they get assigned an IP. After the DHCP server reaches the top IP, not enough time has passed (the minimum of 20 min) to force the DHCP server to release the IPs. That seemed to me what the report was all about, which is not a bug at all, it's normal expected behavior. But, you're right, we'll need to see some usage scenarios to make absolutely sure that we're on the same page.

@sparko
Can you provide more and detailed steps to reproduce this? And please don't include Jenkins, not everyone has that installed and not everyone might install it to verify a rogue behavior. If you can provide a script where you simply use VirtualBox, provide the start time and end time, provide the "rate" to which you create the VMs, we might be able to try it out.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
michaln
Oracle Corporation
Posts: 2973
Joined: 19. Dec 2007, 15:45
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Any and all
Contact:

Re: VBox DHCP exhaust IPs

Post by michaln »

Please check the public bug tracker and if there's no existing ticket open for this problem, create one. The forum is a very poor issue tracking tool.
Post Reply