I'm trying to create a Vagrant base box following the 2 resources here:
- http://docs-v1.vagrantup.com/v1/docs/base_boxes.html
- https://github.com/fespinoza/checklist_and_guides/wiki/Creating-a-vagrant-base-box-for-ubuntu-12.04-32bit-server
Using Ubuntu 12.10 (with LAMP) as the OS, I have 1 problem. I couldn't ping the vagrant IP which is 10.0.2.15 although I could SSH via vagrant ssh
.
How do I set it up such that I could access the web server from my host?
VirtualBox: 4.2.10
Guest OS: Ubuntu12.10
Host: OSX 10.8.3
Best Answer
You can't just access a Vagrant box with its IP address from the host system. Vagrant's networking is meant to define an abstraction layer that works across multiple providers.
The easiest way to access services on your Vagrant box is to configure port forwarding. In your Vagrantfile, see the section Vagrant.configure and set values for
config.vm.network :forwarded_port
. For example, the following configuration forwards port 4567 on your local system to port 80 on the Vagrant box:After making this change, run
vagrant reload
to apply the changes. After applying the change, you should be able to point your web browser tohttp://127.0.0.1:4567
to have the Vagrant Apache instance serve a web page. You can read a bit more about this in the Vagrant V2 documentation or on the Vagrant networking page.