My VM (Ubuntu 12.04) has 2 network interfaces attached which is recognized as eth0
and eth1
.
Now I want to change the cards to virtio to improve the performance, so I open VM settings and change both adapters' types to Paravirtualized Network (virtio-net)
But after rebooting the performance seems to be the same, not to say even much slower, and when I checked ifconfig
output there's another virbr0
interface beside eth0
and eth1
.
I thought that changing the type in VirtualBox will make eth0
and eth1
become a virtio adapter. This was later confirmed by a few pages I found on the internet. They said that just changing the adapter type is enough and the speed will be improved immediately. But in my case it isn't.
How to configure the adapters in order to make it work?
The configuration is like this. eth0
is a bridge to the external network. eth1
is a host-only adapter
$ ifconfig
eth0 Link encap:Ethernet HWaddr 08:00:27:62:0d:bd
inet addr:10.184.130.70 Bcast:10.184.130.255 Mask:255.255.240.0
inet6 addr: fe80::a00:27ff:fe64:dbd/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:411321 errors:0 dropped:2 overruns:0 frame:0
TX packets:118875 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:298154310 (298.1 MB) TX bytes:65017532 (65.0 MB)
eth1 Link encap:Ethernet HWaddr 08:00:27:9d:6b:df
inet addr:172.17.0.6 Bcast:172.17.255.255 Mask:255.255.0.0
inet6 addr: fe80::a00:27ff:fe8d:6bdf/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:12445 errors:0 dropped:0 overruns:0 frame:0
TX packets:13566 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1275663 (1.2 MB) TX bytes:8705940 (8.7 MB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:8538 errors:0 dropped:0 overruns:0 frame:0
TX packets:8538 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2286738 (2.2 MB) TX bytes:2286738 (2.2 MB)
virbr0 Link encap:Ethernet HWaddr 76:ee:57:37:78:7c
inet addr:192.168.122.1 Bcast:192.168.122.255 Mask:255.255.255.0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
I've ran lsmod | grep virt
but no result is shown. insmod
shows nothing like virtio_net
either
$ insmod virt<tab><tab>
virtio_balloon virtio_console virtio_mmio virtio-rng virtual
The current kernel Linux vmdev 3.2.0-124-generic #167-Ubuntu SMP Fri Mar 3 15:26:21 UTC 2017 i686 i686 i386 GNU/Linux
. Is there any options I need to enable the loading of virtio driver?
The file /etc/udev/rules.d/70-persistent-net.rules
shows nothing related to virtio either, except in the comment when I regenerate the MAC address of the adapter
I've done a lot of tests with iperf
and the results with Intel PRO/1000 adapter vary around 250-350Mbps while the results with virtio-net card always lie between 100-150Mbps, far below my expectations. So I'm switching back to e1000 card right now until a solution is found.
I've seen some possible related problems on the internet but no way to solve so far
- https://getsatisfaction.cumulusnetworks.com/cumulus/topics/cumulus-vx-virtualbox-virtio-nic-slow
- https://bugs.launchpad.net/ubuntu/+source/qemu-kvm/+bug/1079212
- https://forums.virtualbox.org/viewtopic.php?f=7&t=26783
Edit:
My project has updated to a new 64-bit Ubuntu 14.04 VM (3.13.0-86-generic #131-Ubuntu SMP Thu May 12 23:33:13 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
) but the results are still the same. virtio is still much slower than Intel 1000
virbr0
interface is not created by VirtualBox or the virtio-net driver. It’s probably the result of having libvirt installed. Also, I wouldn’t count on virtio-net making things faster. The VirtualBox implementation might just be crap.virbr0
bridge. libvirt is known to create it.