Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have a Debian image setup on Virtualbox that uses the default NAT to access the internet. It was working fine before I upgraded to 12.10. After I upgraded the DNS lookups no longer work. I still can access ip addresses, but this is not a nice solution.

share|improve this question
2  
    
Upstream VirtualBox bug: virtualbox.org/ticket/10864 –  Piet Delport Mar 1 '13 at 8:55

5 Answers 5

FYI I have grabbed the most recent version of VirtualBox (4.2.16) and it fixes this issue. No CLI commands are necessary to have working DNS on a NAT network.

share|improve this answer

In addition to VBoxManage modifyvm "name" --natdnsproxy1 on, I also had to run VBoxManage modifyvm "name" --natdnshostresolver1 on on each of my VMs to get DNS working. I found that tip on this page.

share|improve this answer
    
Thanks for this! It did the trick for me. –  Shimon Rura Dec 23 '12 at 15:16
    
Sweet, found it somewhere else and it worked for me... then saw this hit a little further down the search results so had to vote it up. –  El Yobo Jan 12 '13 at 11:40
    
Only "--natdnshostresolver1 on" should actually be necessary, not "--natdnsproxy1 on". –  Piet Delport Mar 1 '13 at 10:30
    
This did not work. Both of them. I am using this batch script (gist.github.com/kapitanluffy/61316b4595f3b63ccf41) and does not work.The adapter type is PCnet-PCI II –  kapitanluffy Mar 24 '13 at 20:37
    
I have set the resolv.conf to 8.8.8.8 and it worked. Do I still need to issue the modifyvm commands? –  kapitanluffy Mar 24 '13 at 20:44

Apparently you need to upgrade VritualBox to 4.2, otherwise it won't work

share|improve this answer
1  
Is this your personal experience? Did you find this documented anywhere? –  Lord Loh. Nov 2 '12 at 20:21
1  
I can confirm (from personal experience) that upgrading to 4.2 seems to fix the issue... my box wasn't able to connect to the internet, after the update it magically works. –  Ben Dec 17 '12 at 11:47

The --natdnsproxy1 on didn't work for me. :(

But I was able to go into the virtual machine and set my DNS server by hand, and that worked.

My host machine is resolving to the loopback device. Not sure how or why /etc/resolv.conf got set to the loopback. My host network connection has a static DNS server configured, that is NOT set to the loopback device.

But everything is resolving fine on my host machine, via the loopback. Odd.

share|improve this answer
    
Oops, just realized it isn't the loopback, it is instead; Received 43 bytes from 127.0.1.1#53 in 67 ms Which seems to be explained here; debian.org/doc/manuals/debian-reference/… –  Ted Parvu Oct 24 '12 at 21:23
1  
It is the loopback device, but it is not localhost. The DNS entry pointing to 127.0.1.1 though, is a result of Ubuntu using a local caching nameserver, which is running on that interface. –  dobey Oct 24 '12 at 21:37
up vote 11 down vote accepted

Got it

VBoxManage modifyvm "VM name" --natdnsproxy1 on

Virtual box has a DHCP server for the NAT engine. Which has a list of registered DNS servers. The above command hides 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

share|improve this answer
    
Do you know if there is a way to set this as the default, or change this in the GUI? I'm having the same issue, but typing that for all my VMs seems like a lot of work I'd rather avoid. Thanks. –  dobey Oct 23 '12 at 3:14
1  
@dobey I'm petty sure you cant do this in the GUI. If you have a lot I would probably write a script. You can get list of your VMs names with VBoxManage list vms Then just iterate through that list –  null_radix Oct 23 '12 at 23:51
    
That's unfortunate if so. There should be a way to set it as the default. Perhaps the package needs patched or something then. :-/ –  dobey Oct 24 '12 at 0:26

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.