[WorksForMe] bandwidthctl bandwidth limiting not working (windows host and guest)

Discussions related to using VirtualBox on Windows hosts.
Post Reply
Jovial_Jack
Posts: 6
Joined: 20. Jun 2018, 11:04

[WorksForMe] bandwidthctl bandwidth limiting not working (windows host and guest)

Post by Jovial_Jack »

I’m having difficulty getting bandwidth limiting working per VBoxManage bandwidthctl syntax in the manual.

I have a lone guest "Win10" with a single adapter set to NAT.
lone "adapter 1" in use by guest
lone "adapter 1" in use by guest
img2.png (14.71 KiB) Viewed 1665 times
It functions fine at full bandwidth. The VBoxManage bandwidthctl commands appear to apply without issue such that after adding the bandwidth group the list command confirms it’s been accepted. “Set” does update the limit and “remove” does indeed remove the group.

So in my simple use case…

Code: Select all

VBoxManage bandwidthctl Win10 add Limit --type network --limit 3m
VBoxManage modifyvm Win10 --nicbandwidthgroup1 Limit
Booting up the guest and testing the upload speed with Ookla speedtest or azure upload test indicate the bandwidth limit isn’t working (It tests at approx. 12mbps instead of 3)

Am I misinterpreting nicbandwidthgroup1 to represent “adapter 1” of the guest?? ..And nicbandwidthgroup2 represents “adapter 2” of the guest etc etc.

Things I’ve tried… (Between each change I removed the bandwidth group and recreated fresh)
  • -Toggled the NIC to bridged.
    -Disabled adapter 1. Enabled adapter 2 and modified the command to reflect nicbandwidthgroup2 instead.
    -Deleted and recreated the VirtualBox Host Only Adapter.
Thoughts??
lone virtualbox host adapter
lone virtualbox host adapter
img1.jpg (46.62 KiB) Viewed 1665 times
Last edited by socratis on 21. Jun 2018, 22:37, edited 1 time in total.
Reason: Marked as [WorksForMe].
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: bandwidthctl bandwidth limiting not working (windows host and guest)

Post by socratis »

Jovial_Jack wrote:Booting up the guest and testing the upload speed with Ookla speedtest or azure upload test indicate the bandwidth limit isn’t working
I didn't test these two, I tested something closer geographically, but the limits were working. In both NAT and Bridged that I tried.
Jovial_Jack wrote:Am I misinterpreting nicbandwidthgroup1 to represent “adapter 1” of the guest?
No, that's exactly what it means.
Jovial_Jack wrote:Deleted and recreated the VirtualBox Host Only Adapter.
That wasn't necessary, unless you were testing the speed between your host and your guest.

Right-click on the VM, "Show in Explorer". ZIP that selected ".vbox" file and attach it here. And I'd like to see the one that fails, not a random 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.
Jovial_Jack
Posts: 6
Joined: 20. Jun 2018, 11:04

Re: bandwidthctl bandwidth limiting not working (windows host and guest)

Post by Jovial_Jack »

@socratis

Thanks for checking it! Inspired me to dig deeper. I have a couple PCs running VirtualBox and I noticed a difference between the Global Tools -> vBox Host Only Ethernet Adapters. Even though internet traffic was passing fine I noticed the adapter was configured manually and DHCP server off on it. It didn't match my other PC that was configured manually yet DHCP server on. (I can't recall a time having visited it/changed the default) That's why I removed and recreated. Doing so didn't put back the same manual settings, so I just went with the bullet option "configure adapter automatically." The internet was working, so I didn't reapply the custom settings and kept tinkering with the bandwidthctl stuff. Today I went back and reapplied the exact default manual config my other PC had (192.168.56.1 + DHCP) and bam the bandwidth limiting actually worked.

Apparently to drive myself nuts...I was curious to see if bandwidthctl limiting would break if I disabled DHCP. Nope, still working. Toggled back to "configure automatically." Nope still working. I'm a little surprised the guest VM still passes internet traffic no matter what. To top it off, now when I select "configure adapter manually" and click apply the GUI instantly switches the bullet back to automatic selection. Doesn't matter if I apply disabling the DHCP server option first or even boot and shutdown the VM. It wants to force automatic no matter what. The internet and bandwidthctl limiting are working so I'm going to leave it until I run into other negative consequences at which point I'll attempt deleting and recreating the "vBox host only adapter" again.

Thanks again for checking. If by chance you have insight into the other quirks I'm always eager to learn and understand the nuances of VirtualBox.
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: bandwidthctl bandwidth limiting not working (windows host and guest)

Post by socratis »

I honestly don't understand where these "HostOnly adapter" question came from. This is totally unrelated to the original problem and the the thread title. Pretty much, from all your response the important part was:
Jovial_Jack wrote: The internet and bandwidthctl limiting are working
which is why I'm going to mark this thread as [WorksForMe].

Your HostOnly questions are definitely valid, but not for a thread titled "bandwidthctl bandwidth limiting not working (windows host and guest)". Open a new appropriately titled thread and we can talk about it all you want... ;)
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.
Jovial_Jack
Posts: 6
Joined: 20. Jun 2018, 11:04

Re: [WorksForMe] bandwidthctl bandwidth limiting not working (windows host and guest)

Post by Jovial_Jack »

Sounds good.

Another possible variable here is on initial use I attempted to adjust the limit rate while the guest VM was running. I'd get an error kickback about the VM being locked. Though the documentation suggests it should work even with the VM online, not once have I been able to get that to work. Even a couple times it wouldn't update when I'd take the VM offline (giving me an "in use" error dialogue once) and another time no error, but wouldn't actually apply in the VM. Both times I had to reboot. A couple times the "set" command would kick back no error dialogue and CMD jumped to it's next awaiting command line as if it had successfully updated the set limit. Yet, on reboot I'd check it again with the list command and see it never actually updated the set limit. It would be it's previous value. Hopefully I'm the only user observing these behaviors. At least after these extra efforts it's definitely working. Have a great weekend.
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: [WorksForMe] bandwidthctl bandwidth limiting not working (windows host and guest)

Post by socratis »

Jovial_Jack wrote: Though the documentation suggests it should work even with the VM online, not once have I been able to get that to work.
The documentation talks about "setting the limits", not modifying the VM, by setting up the limit groups and the network cards to belong (or not) to the limit group. So, for example, I would expect these to work:
  • 
    VBoxManage bandwidthctl add | set | remove | list
and I would expect this to fail:
  • 
    VBoxManage modifyvm "<VM_name>" --nicbandwidthgroup<1-N> NetLimit
for a running VM. Mainly because the "modifyvm" needs the VM to be shutdown. If there was an equivalent to change the VM while the VM was running, the command would have been:
  • 
    VBoxManage controlvm "<VM_name>" --nicbandwidthgroup<1-N> NetLimit
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.
Jovial_Jack
Posts: 6
Joined: 20. Jun 2018, 11:04

Re: [WorksForMe] bandwidthctl bandwidth limiting not working (windows host and guest)

Post by Jovial_Jack »

Agreed.

Yeah in my case I've been using the "set" syntax as it's presented in the manual
https://www.virtualbox.org/manual/ch06. ... idth_limit

So in my case...
VBoxManage bandwidthctl Win10 set LimitedGroup --limit 15m
Unfortunately there hasn't been a time that I don't get a kickback approximate as follows:

Code: Select all

VBoxManage.exe: error: Code E_FAIL (0x80004005) - Unspecified error (extended info not available)
VBoxManage.exe: error: Context: "LockMachine(a->session, LockType_Shared)" at line 322 of file VBoxManageBandwidthControl.cpp
I took at peak at VBoxManageBandwidthControl.cpp as noted here https://www.virtualbox.org/svn/vbox/tru ... ontrol.cpp

Code: Select all

   321 /* open a session for the VM (new or shared) */
   322 CHECK_ERROR_RET(machine, LockMachine(a->session, LockType_Shared), RTEXITCODE_FAILURE);
   323  SessionType_T st;
I see another thread about LockType.Shared
viewtopic.php?f=34&t=60165

Yet, I don't know what to make of it since, I've just been using the GUI with defaults.

I'm thrilled it eventually works offline though.
Post Reply