How to set up QoS bandwidth rate limit on XenServer VM's network interfaces

Last updated on January 8, 2014 by Dan Nanni

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 (now renamed to "Citrix Hypervisor") 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.

$ xe vm-list

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.

$ xe vm-list name-label=<your-vm-name-label> | grep "uuid" | cut -f1 | awk '{print $5}' 

The above command will print out the UUID of your VM, which will be used in the subsequent command.

$ xe vif-list vm-uuid=<your-vm-uuid> | grep "uuid" | cut -f1 | awk '{print $5}' 

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.

$ xe vif-list vm-uuid=<your-vm-uuid>

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_type=ratelimit
$ 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 100Kbps.

Finally, you need to unplug and replug the interface in order to activate the rate limiting as follows.

$ xe vif-unplug uuid=<my-vif-uuid>
$ xe vif-plug uuid=<my-vif-uuid>

As of this writing, XenServer does not support rate limiting on ingress traffic of VM network interfaces.

Support Xmodulo

This website is made possible by minimal ads and your gracious donation via PayPal or credit card

Please note that this article is published by Xmodulo.com under a Creative Commons Attribution-ShareAlike 3.0 Unported License. If you would like to use the whole or any part of this article, you need to cite this web page at Xmodulo.com as the original source.

Xmodulo © 2021 ‒ AboutWrite for UsFeed ‒ Powered by DigitalOcean