By akh, 5 years ago
In NAT mode (the default one), virtualbox does not give you the possibility to directly connect to your guest os.
Here is how to configure your Virtualbox to simply ssh myguest
For example my guest is called "Solaris10u6", configured to used e1000 card, the default in solaris configuration, (The host os is a Mac).
Type this command in terminal:
VBoxManage setextradata Solaris10u6 "VBoxInternal/Devices/e1000/0/LUN#0/Config/ssh/Protocol" TCP
VBoxManage setextradata Solaris10u6 "VBoxInternal/Devices/e1000/0/LUN#0/Config/ssh/GuestPort" 22
VBoxManage setextradata Solaris10u6 "VBoxInternal/Devices/e1000/0/LUN#0/Config/ssh/HostPort" 2222
It stands for redirect all connection to TCP port 2222 from the host os (my mac) to the port 22 of the guest (my solaris).
To connect to your Virtual machine guest simply do ssh -p 2222 localhost and you are in.
If you want to check all the config applied to a guest type in terminal:
VBoxManage getextradata Solaris10u6 enumerate
By the way if you get this kind of errors:
Configuration error: Failed to get the "MAC" value (VERR_CFGM_VALUE_NOT_FOUND).
It means you have set the config to a network adapter which is not the one used by your guest for example, this wil raise an error when you will start the vm if you are using a e1000 adapter:
VBoxManage setextradata Solaris10u6 "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/Protocol" TCP