Virtual Box limit Bandwith on network [closed]

2020-08-13 07:42发布

问题:

I am using virtual machine VirtualBox

Now, I need to limit bandwith. I have 2 Virtual Machines running. One is just for fun. One is for important database access. I need to tell the "fun machine" to just use bandwith on network with less priority if the "database machine" is not using maximum of the bandwith.

I read this But I am working on Windows.

Would be great if you have any suggestions.

回答1:

UPDATED

Starting with VirtualBox 4.2, the networking subsystem has support for limiting the maximum bandwidth of a connection. There isn't a graphical user interface for the commands yet so you will have to use the VBoxManage command line to manage the settings. From the manual:

Limits are configured through VBoxManage. The example below creates a bandwidth group named "Limit", sets the limit to 20 Mbit/s and assigns the group to the first and second adapters of the VM:

VBoxManage bandwidthctl "VM name" add Limit --type network --limit 20m
VBoxManage modifyvm "VM name" --nicbandwidthgroup1 Limit
VBoxManage modifyvm "VM name" --nicbandwidthgroup2 Limit

Important Note: VirtualBox only limits outbound traffic from the VM. It does not limit incoming bandwidth. Additional information can be found in the VirtualBox manual, chapter 6 - Virtual Networking: http://www.virtualbox.org/manual/ch06.html#network_bandwidth_limit

ORIGINAL ANSWER

This really is kind of a difficult situation - neither VirtualBox or Windows provide a supported, native way to handle traffic management like you have requested. The good news is that the VirtualBox team is working on a solution to your problem - you may have noticed in recent releases they have added in proper support for CPU usage controls. Hopefully something in the 4.1 or later releases will have the feature you desire.

So what can you do in the mean time? I would suggest looking at programs like NetLimiter that you can run your Window 7 "fun" guest. You will be able to configure all sorts of limits to ensure it doesn't disrupt your overall network access.



回答2:

What you could do is to create virtual network interface on host and set it in virtual machine network settings as the bridged interface. That would not give you bandwidth limiting yet but you would have separate interfaces for these 2 use cases. Having 2 interfaces will make next step (limiting) easier. I'm not network expert so I can't tell how to limit specific interface, especially on Windows.

Here are some tips, maybe some of them can be applied to your usecase: http://ku1ik.com/2011/11/12/tunnel-vm-network-ssh.html