how to ssh into a guest VM

if a virtualbox VM is created using the default network configuration, it is set to use NAT from the host interface. To enable access to the VM’s network ports, one can configure port forwarding for the VM in the VirtualBox GUI. We’ll use these settings:

Table 1. Settings
system ip address network port

host

127.0.0.1

32022

guest

10.0.2.15

22

  • Open the VM’s network settings, and select the Port Forwarding button.

  • Click the Add button

  • Configure the fields as above

To make life ease, one can add a stanza to * $HOME/.ssh/config * as below:

host vbox
        hostname 127.0.0.1
        port 32022