Host system is Vista, guest named BoxInABox is Debian lenny. The guest is configured in VirtualBox settings to use NAT.
To set up port forwarding for ssh into the guest, I followed the directions at this link: http://mydebian.blogdns.org/?p=148. On the host I did:
vboxmanage setextradata BoxInABox "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/HostPort" 2222 vboxmanage setextradata BoxInABox "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/GuestPort" 22 vboxmanage setextradata BoxInABox "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/Protocol" TCP
and restarted the guest. Now if I do nmap -p 2222 on the host I can see that the port is "open", but when I try this on the guest host:
ssh -p 2222 localhost
I get this: ssh_exchange_identification: Connection closed by remote host
I don't really know how to diagnose this any further. ssh to localhost on the guest works just fine.
*edited: I actually did try this on the host, not the guest as originally typo'd.