Kvm virtio

KVM provides (at least) two network interface card modes. The standard mode uses the operating system's native network card drivers, but typically provides less than optimal performance due to the involvement of the hypervisor. The virtio driver is a paravirtualized driver.

Switching from the standard driver to a paravirtualized driver is fairly simple (but not well documented for specific distributions of linux).

These directions work for a RHEL 5 guest.

Before setting up the KVM guest to boot with a virtio driver, you must configure

1) Load the virtio_net kernel module with 'modprobe virtio_net'

2) run depmod with 'depmod -ae CURRENT_KERNEL_VERSION' where CURRENT_KERNEL_VERSION matches the directory name of the current kernel in /lib/modules

3) shutdown the guest

4) change the KVM launch command by adding the "model=virtio" parameter. For example, change "-net nic" to "-net nic,model=virtio"

    • Note that the "-net nic" command could have additional parameters such as "-net nic,macaddr=52:54:00:00:00:00" and this can be changed to "-net nic,macaddr=52:54:00:00:00:00,model=virtio" to enable virtio

5) start the guest with the model=virtio parameter.

6) use the network card as you usually would, except that its name is hpet0