Wednesday, July 6, 2016

Virtio Para-virtualized Network Driver with VirtualBox

UPDATE 7/20/2016: I recommend you also read my more recent Vagrant 1.8.5 and VirtualBox 5.1 Networking Performance post with update network performance numbers from VirtualBox 5.1 and a better method to enable Virtio with Vagrant/VirtualBox.


While traditionally emulators, including VirtualBox, have utilized emulated hardware devices today there is another option. Modern Linux kernels (>= 2.6.25 unless your distro backported it) support para-virtualized network devices drivers which are optimized for use in an emulated guest. This avoids much of the performance loss and other compatibility problems with emulating hardware devices. To illustrate the advantages here are some quick iperf numbers from a Xenial image running under Windows 10 in VirtualBox 5.0.24
  • Intel 1000 Pro MT Server: 236 Mbits/sec
  • Virtio Paravirtualized Network: 361 Mbits/sec
Anecdotally the performance of the Virtio driver also appears more consistent with the hardware emulation mode sometimes "hiccupping", and lower general cpu utilization.

Using the Virtio Para-virtualized Network Driver

Utilizing the Virtio Para-virtualized network driver is quick and easy in the current version of VirtualBox.
  • Confirm your Linux guest are configured to use the KVM paravirtualization provider – this should be the default in recent VirtualBox versions. This also enabled paravirtualized clocks and SMP spinlocks.
  • Change your network adapter type to ‘Paravirtualized Network (virtio-net)’.

  • Reboot and your Linux guest will automatically use the new driver. To confirm ‘lspci’ should now show your network card as ‘Ethernet controller: Red Hat, Inc Virtio network device’.
For more information about the Virtio driver, or VirtualBox networking in general, please see the Chapter 6. Virtual networking of the VirtualBox User Manual. 

3 comments:

  1. Thanks, looking for "KVM Paravirtualization" under "System" -> "Acceleration" is a great way to determine if pre-existing VMs support being switched to virt-io!

    ReplyDelete