39

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?

3 Answers 3

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

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

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)

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .