Vagrant / VirtualBox DNS 10.0.2.3 não funciona

69

Estou executando uma nova instalação do Linux Mint Nadia (14). Eu estou seguindo as instruções do Vagrant, mas fiquei preso no Introdução /www.vagrantup.com/docs/provisioning/">Provisionamento . Parece que a caixa do Vagrant não pode se conectar do lado de fora e, por isso, não consigo instalar nada usando o Chef ou o Puppet.

No Vagrant básico resolve.conf contém nameserver 10.0.2.3 . Mas com esse conjunto eu não consigo pingar us.archive.ubuntu.com .

Se eu alterá-lo para 8.8.8.8 , posso pingar us.archive.ubuntu.com , mas ele não fica definido e, após a reinicialização, ele volta a 10.0.2.3 - portanto, o provisionamento falha novamente.

Idealmente, gostaria que 10.0.2.3 trabalhasse na minha configuração. Caso contrário, eu gostaria de alterar permanentemente resolv.conf para que eu possa fazer o provisionamento.

    
por Rudolf Vavruch 28.11.2012 / 20:45

2 respostas

75

Você pode contornar esse problema de duas maneiras: no 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.

    
por 29.11.2012 / 01:36
65

Continuando com o link , se você estiver usando um formato de configuração Vagrantfile versão 2, aquele que começa:

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

Então você pode querer adicionar isso ao arquivo de configuração:

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

Se você estiver usando o formato de configuração antigo, mas estiver usando o Vagrant 1.1+, poderá anexá-lo ao final do arquivo:

Vagrant.configure("2") do |config|
  config.vm.provider :virtualbox do |vb|
    vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
  end
end
    
por 08.05.2013 / 22:13