I'd like to set up a Linux virtual machine using Virtualbox on OS X in the following way:
- I'd like to use a virtual network, with my physical machine acting as a NAT to the wider internet / other networks. So, my virtual machine should have an IP address which is visible from my physical machine (I can browse to http://172.something/ and see a web server running on the virtual machine) but other machines on my physical network should NOT be able to see the virtual machine.
- I'd like the virtual machine to be able to see "out" - it should be able to access resources on the rest of my network and on the internet as a whole.
I'm not interested in bridged networking (where the virtual machine gets an IP address on my physical network). I switch networks a lot and will be running this on a laptop, so anything that breaks if I switch from ethernet to WiFi or back again is bad.
I've tried pretty much every combination of network settings in Virtualbox and I haven't managed to get both of the above bullet points working at once - I can set up a private network behind NAT but then the virtual machine can't see the internet. I can get the virtual machine to see the internet but then I don't seem to get an IP address that my physical machine can use to access servers running on the virtual machine.
I've managed to get this setup working in both VMWare Fusion and Parallels without any trouble - any ideas how to get it working in Virtualbox?