36

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?

29

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).

  • 1
    I 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 May 11 '15 at 1:33
  • Does anyone know what are all the other possible values ? Any link to the docs ? – nha May 22 '15 at 11:51
  • no improvement for me I'm afraid. Vagrant 1.7.4, Virtualbox 5.0.4 – lsh Oct 22 '15 at 13:06
  • All possible options are here: virtualbox.org/manual/ch08.html#idp46730496367936 Try Am79C973 too if you have problems with virtio. – Juliusz Gonera Feb 7 '16 at 18:54
  • 1
    VBoxManage modifyvm YourMachineName --nictype1 virtio – Brian Low Apr 14 '16 at 2:56
16

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)

  • 1
    Worked for me with Host Ubuntu 14.04 and Guest Ubuntu 12.04. – ross Dec 15 '15 at 19:14
  • 1
    To switch to PCNet Fast III in Vagrantfile, use v.customize ["modifyvm", :id, "--nictype1", "Am79C973"]. – Juliusz Gonera Feb 7 '16 at 18:56
  • 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 Aug 6 '16 at 4:04
  • Worked with Win10 host running Ubuntu 16.10. – robsn Dec 12 '16 at 12:48
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

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.