I recently set up a Linux server (Ubuntu 12.04 server) as a virtual machine under virtual box. In the past I have always used the standard install of Ubuntu (i.e. a graphical interface).
Having installed the server edition (and OpenSSH) I was surprised that I was not able to log into the virtual machine over SSH.
Thankfully the solution I found is very easy to implement and involves changing a setting in the VirtualBox app for the virtual machine you want to change. In the settings, click on the Network tab and change the “Attached to” option to a “Bridged Adapter”. This will result in the virtual machine taking an IP address in the same range as your physical machine and will then be accessible via SSH.
If your network will not allow an IP address to be assigned dynamically over DHCP, then there are other options. For example, there is an option in the same drop-down menu called “Host-only Adapter”. To use this, you will first of all need to set the adapter up in the VirtualBox application preferences (not the virtual machine settings). To set the network up, open the preferences and navigate to the “Network” tab. There you will be able to add an adapter. I have left all the default settings in place. In the network settings for the VM, you can now select the “Host-only Adapter” option. The host machine will be able to access the VM and all VMs on this setting should also be able to see each other.