How to fix extremely slow Virtualbox network download speed?

37

20

I'm using an Ubuntu 12.04 VM (hashicorp/precise32) via Vagrant/Virtualbox. It seems to have an exremely slow download speed compared to my host system. This is what I get with the host system (OSX) with speedtest-cli:

Testing download speed........................................
Download: 845.62 Mbits/s
Testing upload speed..................................................
Upload: 296.03 Mbits/s

And this is what I get in the guest OS (Ubuntu 12.04):

Testing download speed........................................
Download: 12.41 Mbits/s
Testing upload speed..................................................
Upload: 247.64 Mbits/s

So host download speed is 70 times faster! The usual response to these issues is this:

config.vm.provider "virtualbox" do |v|
  v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
  v.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
end

But I have already configured it to my Vagrantfile.

I also tested this with plain Virtualbox and 12.04 (no Vagrant). The same issue occurs when I use NAT interface. However, switching to bridged mode makes the download speed 20x faster. This is nasty, since Vagrant relies on the NAT interface to be always eth0.

I use OSX Mavericks as the host system. Virtualbox version is 4.3.18.

Any ideas?

auramo

Posted 2014-12-09T10:59:44.523

Reputation: 963

Answers

30

For vagrant users, add the following to your Vagrant file:

config.vm.provider "virtualbox" do |v|
  v.customize ["modifyvm", :id, "--nictype1", "virtio"]
end

I got a speed boost of ~15x. On VirtualBox GUI I see now a different Adapter Type for my NAT interface: Paravirtualized Network (virtio-net).

auramo

Posted 2014-12-09T10:59:44.523

Reputation: 963

1I had the same issue: the upload speed on a Boot2Docker image running on Vagrant, as measured using speedtest-cli, was 0 (so slow you can't measure it?). As soon as I added this setting, the upload speed matched the speed of my host OS. Thanks! – Yevgeniy Brikman – 2015-05-11T01:33:26.670

Does anyone know what are all the other possible values ? Any link to the docs ? – nha – 2015-05-22T11:51:32.767

no improvement for me I'm afraid. Vagrant 1.7.4, Virtualbox 5.0.4 – lsh – 2015-10-22T13:06:32.017

All possible options are here: https://www.virtualbox.org/manual/ch08.html#idp46730496367936 Try Am79C973 too if you have problems with virtio.

– Juliusz Gonera – 2016-02-07T18:54:49.960

2VBoxManage modifyvm YourMachineName --nictype1 virtio – Brian Low – 2016-04-14T02:56:01.470

lol, from 176k/s to 56M/s after this, thanks! – Gerard Reches – 2017-03-22T18:33:18.947

17

I have found mach simpler solution for me

  • Host ubuntu 14.04
  • guest ubuntu 14.04
  • Nat with port forwarding
  • extremely slow upload speed from guest. It was so slow that speed test even cant measure that.

I just switched to PCNet-Fast III adapter. And speed become good enough for me (40 Mb/s)

paul_di

Posted 2014-12-09T10:59:44.523

Reputation: 271

1Worked for me with Host Ubuntu 14.04 and Guest Ubuntu 12.04. – ross – 2015-12-15T19:14:10.310

1To switch to PCNet Fast III in Vagrantfile, use v.customize ["modifyvm", :id, "--nictype1", "Am79C973"]. – Juliusz Gonera – 2016-02-07T18:56:10.060

This works great! I was having trouble with apt-get hanging while trying to download. Eventually it would work, but changing the network adapter as above sorts the problem out. – Brendon Muir – 2016-08-06T04:04:06.770

Worked with Win10 host running Ubuntu 16.10. – robsn – 2016-12-12T12:48:55.197

0

@auramo's answer is useful, but please note that it specifies a specific NIC: #1. In my system, for instance, I have numerous Network Interfaces. I had to specify --nictype4.

As well, others have reported benefits elsewhere of specifying natdnshostresolver# and natdnsproxy# where # is a number identifying your NIC. In mine, it looks like this:

config.vm.provider "virtualbox" do |v|
  v.customize ["modifyvm", :id, "--nictype4", "virtio"]
  v.customize ["modifyvm", :id, "--natdnshostresolver4", "on"]
  v.customize ["modifyvm", :id, "--natdnsproxy4", "on"]
end

Offlein

Posted 2014-12-09T10:59:44.523

Reputation: 101