I'm a web developer and want to move away from using XAMPP on my machine for developing. I'd like to have my own development server however don't have the hardware so I'm setting one up with VirtualBox. I've gone ahead and installed Ubuntu 12.04.
I've got enough server management knowledge to get by however I'm having trouble wrapping my head around how I can connect to the VM through my host machine. I'd at least like to be able to access it on port 80 (HTTP) and 22 (SSH). I can access it through VirtualBox but eventually I'd want this to be headless and use PuTTY to connect.
From Google'ing, it seems I need two adapters on the VM: a NAT so it can connect to the internet, and a host only adapter so my host machine can connect to the VM. At the moment this is my network configuration in VirtualBox showing my two adapters:
Of course, I also need to know the IP of the machine so I can connect to it. Running
ifconfig brings me this:
I've circled in red the IP address which I think I should be using to connect to the VM. When I try to start an SSH session on this IP and port 22 though, the connection times out. I know it's not a SSH problem because I can run
ssh 127.0.0.1 inside the VM just fine. Also, if it's relevant, I can ping google.com from inside the VM so NAT is working.
What could I be missing here and what do I need to do to be able to access my VM from my host machine?
Edit: To expand a bit, if I use port forwarding for SSH I can successfully connect, however I'd rather set up the host only networking so I don't have to worry about forwarding ports and the VM appears to be on its own IP.