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?

auramo
  • 983

3 Answers3

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

030
  • 2,808
  • 9
  • 29
  • 40
auramo
  • 983
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)

paul_di
  • 291
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
  • 101