Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

This is a follow on to my previous question Vagrant Getting Started gives getaddrinfo: Temporary failure in name resolution.

I am running a fresh install of Linux Mint Nadia (14). I am following the instructions on Vagrant: Getting Started but have gotten stuck on the Provisioning. It seems the Vagrant box cannot connect outside and so I can't install anything using either Chef or Puppet.

In the basic vagrant resolve.conf contains "nameserver 10.0.2.3". But with that set I can't ping us.archive.ubuntu.com

If I change it to 8.8.8.8 then I can ping us.archive.ubuntu.com but it does not stay set, and after a reboot it changes back to 10.0.2.3 - so provisioning fails again.

Ideally I would like for 10.0.2.3 to work on my setup. Failing that I would like a way to permanently change resolv.conf so that I can do provisioning.

share|improve this question

2 Answers 2

up vote 23 down vote accepted

You can work around this issue in one of two ways, both of which are in the VirtualBox manual:

Enabling DNS proxy in NAT mode

The NAT engine by default offers the same DNS servers to the guest that are configured on the host. In some scenarios, it can be desirable to hide the DNS server IPs from the guest, for example when this information can change on the host due to expiring DHCP leases. In this case, you can tell the NAT engine to act as DNS proxy using the following command:

VBoxManage modifyvm "VM name" --natdnsproxy1 on

Using the host's resolver as a DNS proxy in NAT mode

For resolving network names, the DHCP server of the NAT engine offers a list of registered DNS servers of the host. If for some reason you need to hide this DNS server list and use the host's resolver settings, thereby forcing the VirtualBox NAT engine to intercept DNS requests and forward them to host's resolver, use the following command:

VBoxManage modifyvm "VM name" --natdnshostresolver1 on

Note that this setting is similar to the DNS proxy mode, however whereas the proxy mode just forwards DNS requests to the appropriate servers, the resolver mode will interpret the DNS requests and use the host's DNS API to query the information and return it to the guest.

share|improve this answer
    
Thank you. "Using the host's resolver as a DNS proxy in NAT mode" did the trick. It is just a pity I have to do this for every Vagrant install. –  Rudolf Vavruch Nov 29 '12 at 6:13
    
I almost always use bridged mode for VMs, which eliminates the problem (and a whole host of other problems). –  Michael Hampton Jan 12 '13 at 19:55
    
Just had the issue with an upgrade to the 4.2.20, "Using the host's resolver as a DNS proxy in NAT mode" did the trick for me too. Thx ! –  edomaur Dec 12 '13 at 13:12

Following up on http://serverfault.com/a/453260/14832, if you're using a version 2 Vagrantfile config format, the one which starts:

Vagrant.configure("2") do |config|

Then you might want to add this to that config file:

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

If you're using the old config format, but are using Vagrant 1.1+, you can append this at the end of the file:

Vagrant.configure("2") do |config|
  config.vm.provider :virtualbox do |vb|
    vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
  end
end
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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