Linux – Expose virtual machine (vagrant) to local Wifi

linuxUbuntuvagrantvirtualization

I've setup a local virtual machine (ubuntu 12.4) using Vagrant (www.vagrantup.com) and need to share its resources on my local wifi network. It is basically running a webserver which should be accessible by other machines on the local network.

My local wifi adapter gets a dynamic IP address from a router.

My current config looks like this, but i cannot access the machine from another machine using the IP:

config.vm.network :private_network, ip: "192.168.56.101"
    config.vm.network :forwarded_port, guest: 80, host: 8080

How can I make this happen? Any help is highly appreciated!

Best Answer

The private_network is a network that is only between your host and the guest vm. If you want to make the guest vm available to others systems on the same network as your host you need to use the "public_network" setup in vagrant. This will allow your guest to get/use an IP address on the network that your host is on.

config.vm.network "public_network"

http://docs.vagrantup.com/v2/networking/public_network.html