In a multi-tenant VM environment, you would need to allocate network bandwidth appropriately to all existing tenants/VMs, such that no one VM can consume available network resources by itself. Even in a single-user environment, you may want to define QoS policies for your VM (such as per-interface bandwidth caps) for various reasons.
If you are using XenServer as your hypervisor, you should know that XenServer allows you to rate limit outgoing traffic of VM's virtual interfaces. In this tutorial, I will describe how to set up QoS bandwidth rate limit on XenServer VM's network interfaces.
First, I assume that you know the name of your VM. If you are not sure about VM name, you can check it out by using XenServer command line interface (CLI) on XenServer as follows.
It will show you a list of running VMs along with name label for each VM. Make a note of name label of your VM.
Now you need to know the UUID of the network interface attached to your VM, which you would like to rate limit. To do that, proceed as follows.
The above command will print out the UUID of your VM, which will be used in the subsequent command.
The above command will print out the UUID of the virtual network interface attached to your VM. If your VM has more than one network interface, simply run the following instead, and choose an appropriate interface.
After you have obtained the UUID of the network interface, you can proceed to rate limit the interface as follows.
$ xe vif-param-set uuid=<my-vif-uuid> qos_algorithm_params:kbps=100
These commands above set the maximum outgoing bandwidth of the interface to 100 Kbps.
Finally, you need to unplug and replug the interface in order to activate the rate limiting as follows.
$ xe vif-plug uuid=<my-vif-uuid>
As of this writing, XenServer does not support rate limiting on ingress traffic of VM network interfaces.
Subscribe to Xmodulo
Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.
Did you find this tutorial helpful? Then please be generous and support Xmodulo!