Make sure you've added an host-only network adapter and connected it to the VM.
In order to so this on Virtual Box:
Open the VirtualBox preferences menu by clicking on File → Preferences
Click on Network
Click on the tab Host-only Network
- Click on
Add
(the small green “plus” icon on the right side of the window)
An adapter called vboxnet0 will be created. The default settings should be acceptable
Then, from the VM settings assign the adapter to the Macine:
Click on the VM
Click on Settings
Click on Network
Change Network Adapter to be attached to "Host-only Adapter"
- You can also use
Adapter 2
and leave Adapter 1
connected by NAT to the Internet
Make sure the adapter you've just added is selected
Only then, you'll be able to connect to the VM with ssh -X usernme@ipaddress
as @shr wrote.
If you ran info more issues, please read the setup notes