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 am new to Ubuntu (having just installed Ubuntu 12.10) and want to start developing with it. So I have installed Vagrant, downloaded lucid64.box, initialized, started it up and accessed it via ssh.

To the test the Internet connection on my client I've done ping google.com and received unknown host: google.com. (Host got ping of course.)

Searching the web only got me to this solution which suggested to remove Vagrant and Virtual box, and re-install them, just make sure Vagrant installed first. I've tried this solution and I am still getting the same results.

What else can I try to get it to work?

share|improve this question
    
There was an issue with my server client getting a DNS. Using google DNS, changed in /etc/resolv.conf and added to /etc/network/interfaces solved the problem. –  Shahar Galukman Jan 9 '13 at 16:27
    
Can I ask you which tutorial you are using? Just a guess: is it gettingstartedwithdjango? If so, I will contact the author to refer to the present problem. If not, I will delete this comment. –  don.joey Mar 13 '13 at 10:55
    
I'm not using the tutorial you mentioned. Found the solution using common sense yet bayoffire solution is much better, also it's known bug as he mentioned so I do belive it'll be fixed in future release. –  Shahar Galukman Mar 19 '13 at 13:05

4 Answers 4

up vote 17 down vote accepted

I had the same issue with Ubuntu 12.10 and found a solution. Just add those lines to your Vagrantfile:

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

For Vagrant 1.1+ you will need (thanks to farooqsadiq)

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

It seems to be a known bug in VirtualBox on Ubuntu 12.10:

https://bugs.launchpad.net/ubuntu/+source/virtualbox/+bug/1048783

https://www.virtualbox.org/ticket/10864

share|improve this answer
    
Good to know it is a known bug, even though I didn't managed to find something about it myself. The workaround I've mentioned in my comment above solved it for me though. At least other peoples with same error will have two different ways to solve this issue. Thank you. –  Shahar Galukman Jan 12 '13 at 9:24
    
Even more about this issue. Your solution will be more appropriate since DNS configuration made manually (as suggested by me above) will be deleted every time I start the VM –  Shahar Galukman Jan 12 '13 at 9:26
1  
See this answer for a solution on newer versions of Vagrant: askubuntu.com/a/296796/122097 –  Brad Oct 14 '13 at 15:45

For Vagrant 1.1+ you will need

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

Tested on Vagrant 1.2.2

Found on Lyte's Blog http://lyte.id.au/tag/vagrant/

share|improve this answer

You can make the modifyvm trick work across all Vagrant VMs in one hit by putting a snippet in ~/.vagrant.d/Vagrantfile, e.g.:

Vagrant::Config.run do |config|
    config.vm.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
end
share|improve this answer

The (new) default Vagrantfile* contains a bunch of commented-out examples, one of which is as follows:

  # Assign this VM to a bridged network, allowing you to connect directly to a
  # network using the host's network device. This makes the VM appear as another
  # physical device on your network.
  # config.vm.network :bridged

Make sure you un-comment this line:

conig.vm.network :bridged

That will give your virtual machine access to the network/Internet.

* As of version 1.0.6. As of the time of this answer, the latest version in the repository is 1.0.3, it may not have all of the extra examples; in which case, you'll need to add that line of code.

share|improve this answer
    
I would use this only, if NAT does not work. Bridged networks do only work, if you get an IP from the HDCP to the virtual machine. See this: docs.vagrantup.com/v1/docs/bridged_networking.html (not all networks work!) –  lukassteiner Jan 23 '13 at 15:46

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.