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

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.

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

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.

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.

Support Xmodulo

Did you find this tutorial helpful? Then please be generous and support Xmodulo!

The following two tabs change content below.
Dan Nanni is the founder and also a regular contributor of He is a Linux/FOSS enthusiast who loves to get his hands dirty with his Linux box. He likes to procrastinate when he is supposed to be busy and productive. When he is otherwise free, he likes to watch movies and shop for the coolest gadgets.

Leave a comment

Your email address will not be published. Required fields are marked *