From Libvirt Wiki
Revision as of 16:16, 13 October 2008 by (talk | contribs) (Started a page on virtio.)
(diff) ←Older revision | view current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search


So-called "full virtualization" is a nice feature because it allows you to run any operating system virtualized. However, it's slow because the hypervisor has to emulate actual physical devices such as [ network cards]. This emulation is both complicated and inefficient.

Virtio is a Linux standard for network and disk device drivers where just the guest's device driver "knows" it is running in a virtual environment, and cooperates with the hypervisor. This enables guests to get high performance network and disk operations, and gives most of the performance benefits of paravirtualization.

Note that virtio is different, but architecturally similar, to Xen paravirtualized device drivers (such as the ones that you can install in a Windows guest to make it go faster under Xen). Also similar is VMWare's Guest Tools.

This page describes how to configure libvirt to use virtio with KVM guests.


  • KVM (not QEMU, not Xen)
  • A virtio-compatible guest: any Linux OS with kernel >= 2.6.25 should be OK. Fedora 9 and above are explicitly supported.
  • libvirt >= 0.4.4

We assume that you have installed the virtio-compatible guest under KVM using libvirt (ie. using something like virt-install or virt-manager).

Network driver

First, shut down the guest and then edit its configuration file:

virsh edit guestname

In the <interface> section, add a virtio model, like this:

<interface type='network'>
  <model type='virtio' />

When you boot the guest (virsh start guestname), if it worked you should still have a working network, and you should see (from inside the guest) that you are using the virtio_net driver:

# /sbin/lsmod | grep virtio
[shows virtio_pci, virtio_net and others loaded]
# cat /sys/devices/virtio-pci/0/net/eth0/statistics/rx_bytes

If it doesn't work, then check the following file in the host for errors:


There are quite a lot of things that could go wrong such as: not using KVM, or not using a sufficiently recent version of KVM.

Disk (block) device driver

External links