Post forwarding for VirtualBox is quite simple once you know what you do (as always ;)).
- Close the VirtualBox main window and shutdown all machines that are running. I found that VirtualBox overwrites the xml configuration files if you change them while it is still open.
- cd to your virtual machine’s directory (default should be: ~/.VirtualBox/Machines/Name\ of\ Virtual\ Machine)
- open the xml-File you find inside the directory, (your favorite editor should be the vi so enter: vi Name\ of\ Virtual\ Machine.xml)
- Add the following lines in between the <ExtraData> Tags to forward ssh-Traffic from port 2222 on localhost to port 22 on the virtual machine:
<ExtraDataItem name="VBoxInternal/Devices/pcnet/0/LUN#0/Config/SSH/HostPort" value="2222"/> <ExtraDataItem name="VBoxInternal/Devices/pcnet/0/LUN#0/Config/SSH/GuestPort" value="22"/> <ExtraDataItem name="VBoxInternal/Devices/pcnet/0/LUN#0/Config/SSH/Protocol" value="TCP"/>