I'm trying to set up a vagrant. Host is Ubuntu 12.10. Here's my vagrant file:

Vagrant::Config.run do |config|

    config.vm.share_folder("v-root", "/vagrant", ".", :nfs => true)
    config.vm.network :bridged, :bridge => "eth0"

    config.vm.define "restserver" do |chefs_config|

        chefs_config.vm.box = "precise64"
        chefs_config.vm.box_url = "http://files.vagrantup.com/precise64.box"
        chefs_config.vm.host_name = "restserver"
        chefs_config.vm.network :hostonly, ""
        chefs_config.vm.forward_port 80, 8080

        config.vm.provision :chef_solo do |chef|

            chef.log_level = :debug

            chef.cookbooks_path = "cookbooks"

            chef.add_recipe "apt"
            chef.add_recipe "base"
            chef.add_recipe "mongodb::default"
            chef.add_recipe "nginx"

The problem is that my internet access from within the vagrant is terrible. It's very slow. I think the routing tables might be messed up. Here's the output from route -n:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface         UG    0      0        0 eth0         UG    100    0        0 eth0   U     0      0        0 eth0   U     0      0        0 eth1   U     0      0        0 eth2

There are 2 routes to the default destination, although on the same NIC and to the same gateway. But perhaps this is causing an issue. At least that's what I thought but deleting the first default route doesn't help.

I need host-only networking so the nfs share will work. NAT is used for the port forwarding, and I've added the bridged network to try to give this guest access to the internet.

Has anyone any idea what's wrong? DNS is very slow to resolve, and it's slow to download anything from the internet.

3 Answers 3


Running Version 2 of the Vagrant config?

Sarah's provided the answer which is to use the NAT hosts DNS resolver as it's faster and will help speed things up.

However, in Version 2 of the vagrant config which is what most people are using now you'll have to do add following within your 'Vagrantfile' which will force the VM to uses NAT'd DNS:

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

You can tell if you're using v2 config if you have the following lines or something in the top of your Vagrantfile

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  • 2
    This should be the right answer Sep 3, 2014 at 15:24
  • I tried to boost my vagrant network and it worked, but I had issues with e.g. pulling docker images because of too much DNS lookups. Thus I had to remove this line v.customize ["modifyvm", :id, "--natdnsproxy1", "on"] means I just have this added to my Vagrantfile v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"] Looks like the host resolver is boosting the network performance for some reason and the DNS proxy frags some tools.
    – xh3b4sd
    Jan 9, 2015 at 18:26
  • 1
    THANK YOU! My vm was taking FOREVER to up and ssh into--it would usually just timeout--when connected to the internet/the network. This fixed it. Mar 27, 2017 at 14:15


Add the following to the vagrant config:

config.vm.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]

See here for more: Vagrant / VirtualBox DNS not working

  • 3
    This almost fixed it for me, except that there wasn't a customize method on config.vm. Instead, on my ` config.vm.provider :virtualbox do |vb|` section, I added this: vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
    – Ovid
    Oct 17, 2013 at 6:21
  • 1
    The answer provided by 'sarah' is for the old VagrantFile configuration syntax, and the one provided by 'Ovid' is for the newer configuration syntax. You can tell if you're using the newer syntax by seeing if your configuration file includes Vagrant.configure(2) at the top (note the 2)
    – caseyamcl
    Jan 3, 2014 at 18:02
  • almost. this works for me github.com/mitchellh/vagrant/issues/1807#issuecomment-19132198 vagrant 1.4.3
    – choonkeat
    Feb 26, 2014 at 2:01
  • I'm on Fedora 22 and setting this to "off" was my solution. Oct 13, 2015 at 22:31

The NAT settings didn't improve my download speed.

I had to use the following setting to get proper download rates.

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

You must log in to answer this question.

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