I have a private network VM for developing on my mac. I\'d like for my android device to be able to communicate with the VM on my mac. Currently I can visit the IP defined in my
This can be just a small problem with port forwarding / setting a dmz. Since it's on the same machine; you can interact since it's physically on the same adapter. However if you are trying to access outside of that, you should try tinkering with the ports.
You are using a Private Network IP which is only accessible by the Host machine (NOT visible to other machines even they are in the same WLAN).
In your case, the best choice is to use Public Network (bridged) so that your Android device can access it.
add config.vm.network "public_network"
in your Vagrant file in the config block.
BTW: the default NAT mode is fine but you'll have to set proper port forwarding rules for each service you want to access (e.g. SSH, HTTP, HTTPS etc...).
You can easily access your Vagrant from any machine on your network, by simply ensuring that the port forwarding rules aren't bound to your localhost (127.0.0.1).
If you're using VirtualBox as your provider, you can change this on the fly, so you can have it be private by default (which is of course more secure), and then you can go change it in VirtualBox while your VM is running to expose the port to other machines on your network (and possibly the internet, so be careful!)
Settings | Network | Advanced | Port Forwarding
Host IP
to an empty string, and click OK.The port is now available to other machines on your network, and possibly the internet, so don't do this unless you're positive you're ok with opening up the port!
Of course to revert it, just do the same process and set the Host IP
to 127.0.0.1 again.
A little expansion on the accepted answer: after adding the public network option in your vagrant file and reloading it, ssh into it the old way and then run ifconfig to get the IP you can use to access the vm in your local network from any other device.
Docs: https://www.vagrantup.com/docs/networking/public_network.html