[libvirt] traffic control on hypervisor

Michal Privoznik mprivozn at redhat.com
Fri Jan 10 09:45:23 UTC 2014

On 10.01.2014 09:37, yue wrote:
> hi,all
> if we can control the bandwidth of vm at hypervisor level?
> i know linux tc command  can control traffic, but it is at ISO level 3, 
> vm;s network is on bridge at level 2.
> how libvirt implement traffic control over vm?
> thanks

I'm not sure the linux traffic shaper works on layer 3. I'd say linux
inserts a new layer (called "queuing layer") in between layers 2 and 3
just to allow traffic shaping on bridges too. Hence, there's no need for
libvirt to treat bridges differently than the rest of devices when it
comes to traffic shaping (e.g. TUN/TAP device). If your bridge is
managed by libvirt, you can insert a simple XML snippet to corresponding
network configuration, e.g.:

    <inbound average='1000' peak='5000' burst='5120'/>
    <outbound average='128' peak='256' burst='256'/>


Same applies for each domain's interface:

        <inbound average='1000' peak='5000' floor='200' burst='1024'/>
        <outbound average='128' peak='256' burst='256'/>


If you're interested in implementation details I'd suggest to dive into


Libvirt creates rather a complex tree of qdiscs (things get complicated
once a device hotplug is allowed). But there's nearly a page comment
with a picture showing what's going on.


More information about the libvir-list mailing list