Q:

vagrant port forwarding does not work

I installed a precise32 VM using Vagrant in which I am trying to employ devstack for openstack developing. In order to access the service from host, I set up some forward ports in configure file but it does not work. That is I can not connect to 10.0.2.15 to which devstack prompted me to connect. I tried to switch the networking mode in VirtualBox from NAT to Bridge, then an error popped out saying something like "the NAT name already exists". I checked out the VirtualBox documentation but did not really understand. Anybody help me out please...
I add following to vagrant configure file:
Vagrant::Config.run do |config|
config.vm.forward_port 80, 9090
config.vm.forward_port 5000, 5000
config.vm.forward_port 5672, 5672
config.vm.forward_port 3333, 3333
config.vm.forward_port 8773, 8773
config.vm.forward_port 8774, 8774
config.vm.forward_port 8776, 8776
config.vm.forward_port 8777, 8777
config.vm.forward_port 9191, 9191
config.vm.forward_port 9292, 9292
config.vm.forward_port 35357, 35357
config.vm.forward_port 40529, 40529
config.vm.forward_port 47117, 47117
config.vm.forward_port 55977, 55977
config.vm.customize ["modifyvm", :id, "--memory", 8192]
end

A:

If you have multiple ports to be exposed (port forwarding), it'll be better off using bridged.
Basically you need to enable Public Network in the Vagrantfile, add the following to the config block
config.vm.network "public_network"

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

NOTE: you can leave the default NAT there, vagrant will add a 2nd virtual network adapter.

Once vagrant up completes, vagrant ssh into the box and do a ifconfig -a to get the IP address of the 2nd interface, you should be able to access the services from the host (as they are within the same network / LAN) as long as they bind not only to loopback.

