{"id":4532,"date":"2017-04-30T12:56:25","date_gmt":"2017-04-30T12:56:25","guid":{"rendered":"https:\/\/really.zonky.org\/?p=4532"},"modified":"2017-04-30T12:56:25","modified_gmt":"2017-04-30T12:56:25","slug":"virtualbox-windows-guest-virtual-machines-and-the-virtio-network-interface","status":"publish","type":"post","link":"https:\/\/really.zonky.org\/?p=4532","title":{"rendered":"VirtualBox, Windows Guest Virtual Machines, and The VirtIO Network Interface"},"content":{"rendered":"<p>Despite how long I have been running Windows in virtual machines (as far back as Vmware Workstation 1.0), I have never gotten around to looking at the\u00a0<em>virtio<\/em> network interface &#8211; except for na\u00efvely turning it on once, finding it didn&#8217;t work, and turning it off &#8211; so I decided to have a look at it. I was prompted to do this by a suggestion that emulating the NIC hardware as opposed to simply using a virtual communications channel to the host would hurt network performance. Good job I chose a long weekend because I ran into a few issues :-<\/p>\n<ul>\n<li>Getting appropriate test tools took a while because most of the tools I know of are\u00a0<em>very<\/em> old; I ended up using iperf2 on both the Linux main host and the Windows 10 guest (within the &#8220;Windows<\/li>\n<li>The &#8220;stable&#8221; virtio drivers (also called &#8220;NetKVM&#8221;) drivers didn&#8217;t work. Specifically they could\u00a0<em>send<\/em> packets but not\u00a0<em>receive<\/em> them (judging from the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Dynamic_Host_Configuration_Protocol\">DORA<\/a> conversation that was more of a DODO). I installed the &#8220;latest&#8221; drivers from\u00a0<a href=\"https:\/\/fedoraproject.org\/wiki\/Windows_Virtio_Drivers\">https:\/\/fedoraproject.org\/wiki\/Windows_Virtio_Drivers<\/a>. Note to late readers: this was as of <em>2017-04-30<\/em>; different versions may offer different results.<\/li>\n<li>Upgrading my ancient Debian Jessie kernel to 4.9 on the off-chance it was a kernel bug turned into a bit of an exercise what with ZFS disappearing after the upgrade, and sorting out the package dependencies to get it re-installed was &#8220;interesting&#8221; (for small values of course). No data loss though.<\/li>\n<\/ul>\n<p>I ran two tests :-<\/p>\n<ol>\n<li><em>sudo\u00a0nping &#8211;tcp -p 445 &#8211;count 200 &#8211;data-len 1280 ${ip of windows guest)<\/em> &#8211; to judge how reliable the network connection was.<\/li>\n<li>On the Linux host:\u00a0<em>sudo iperf -p 50001\u00a0<\/em><\/li>\n<li>On the Windows guest (from within the Ubuntu-based environment):\u00a0<em>sudo iperf -p 50001 -c ${ip of Linux host}<\/em><\/li>\n<\/ol>\n<table>\n<tbody>\n<tr>\n<td><strong>Device<\/strong><\/td>\n<td><em>nping result<\/em><\/td>\n<td><em>iperf result<\/em><\/td>\n<\/tr>\n<tr>\n<td>Windows guest (virtual Intel Pro 1000 MT Desktop<\/td>\n<td>1 lost<\/td>\n<td>416 Mbits\/sec<\/td>\n<\/tr>\n<tr>\n<td>Windows guest (virtio)<\/td>\n<td>0 lost<\/td>\n<td>164 Mbits\/sec<\/td>\n<\/tr>\n<tr>\n<td>CuBox running ARM Linux<\/td>\n<td>n\/a<\/td>\n<td>425 Mbits\/sec<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Which is\u00a0<em>not<\/em> the result I was expecting. And yes I did repeat the tests a number of times (I&#8217;ve cheated and chosen the best numbers for the above table), and no I did not confuse which NIC was configured at the time of the tests nor did I get the tests mixed up. And to those who claim that the use of the Ubuntu environment screwed things up, that appears not to be the case &#8211; I repeated the test with a Windows compiled version of iperf with much the same results.<\/p>\n<p>So it seems despite common sense indicating that a NIC &#8220;hardware&#8221; custom designed for a virtual environment should perform better than an emulation of a hardware NIC, the actual result in this case was the other way around. Except for the\u00a0<em>nping<\/em> result which shows the loss of a single packet with the emulated hardware NIC.<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3904\" src=\"https:\/\/i0.wp.com\/really.zonky.org\/wp-content\/uploads\/damascus-unix-prompt1.png?resize=695%2C463&#038;ssl=1\" alt=\"\" width=\"695\" height=\"463\" srcset=\"https:\/\/i0.wp.com\/really.zonky.org\/wp-content\/uploads\/damascus-unix-prompt1.png?w=792&amp;ssl=1 792w, https:\/\/i0.wp.com\/really.zonky.org\/wp-content\/uploads\/damascus-unix-prompt1.png?resize=300%2C200&amp;ssl=1 300w\" sizes=\"auto, (max-width: 695px) 100vw, 695px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Despite how long I have been running Windows in virtual machines (as far back as Vmware Workstation 1.0), I have never gotten around to looking at the\u00a0virtio network interface &#8211; except for na\u00efvely turning it on once, finding it didn&#8217;t work, and turning it off &#8211; so I decided to have a look at it. <a href='https:\/\/really.zonky.org\/?p=4532' class='excerpt-more'>[&#8230;]<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"_share_on_mastodon":"0"},"categories":[4,226],"tags":[1017,1513,1310,370,1512],"class_list":["post-4532","post","type-post","status-publish","format-standard","hentry","category-it","category-working-notes","tag-debian","tag-virtio","tag-virtualbox","tag-windows","tag-windows-10","category-4-id","category-226-id","post-seq-1","post-parity-odd","meta-position-corners","fix"],"share_on_mastodon":{"url":"","error":""},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p1f2KI-1b6","_links":{"self":[{"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/posts\/4532","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/really.zonky.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4532"}],"version-history":[{"count":3,"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/posts\/4532\/revisions"}],"predecessor-version":[{"id":4535,"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/posts\/4532\/revisions\/4535"}],"wp:attachment":[{"href":"https:\/\/really.zonky.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4532"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/really.zonky.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4532"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/really.zonky.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4532"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}