Sunday, December 5, 2010

Connect to VirtualBox Guest through NAT network (Solaris+ssh)

Here the e1000 can be replaced by pcnet, if you are using Windows/Linux guest with PCNet Type of ethernet card emulation.

And Solaris here is the Guest Name

C:\Program Files\Oracle\VirtualBox>VBoxManage getextradata "Solaris" enumerate
Oracle VM VirtualBox Command Line Management Interface Version 3.2.12
(C) 2005-2010 Oracle Corporation
All rights reserved.

Key: GUI/InfoDlgState, Value: 400,450,normal
Key: GUI/LastGuestSizeHint, Value: 720,400
Key: GUI/LastWindowPostion, Value: 265,101,720,442
Key: GUI/MiniToolBarAlignment, Value: bottom
Key: GUI/SaveMountedAtRuntime, Value: yes
Key: GUI/ShowMiniToolBar, Value: yes

C:\Program Files\Oracle\VirtualBox>VBoxManage setextradata "Solaris" "VBoxInternal/Devices/e1000/0/LUN#0/Config/ssh/HostPort" 2222
Oracle VM VirtualBox Command Line Management Interface Version 3.2.12
(C) 2005-2010 Oracle Corporation
All rights reserved.

C:\Program Files\Oracle\VirtualBox>VBoxManage setextradata "Solaris" "VBoxInternal/Devices/e1000/0/LUN#0/Config/ssh/GuestPort" 22
Oracle VM VirtualBox Command Line Management Interface Version 3.2.12
(C) 2005-2010 Oracle Corporation
All rights reserved.


C:\Program Files\Oracle\VirtualBox>VBoxManage setextradata "Solaris" "VBoxInternal/Devices/e1000/0/LUN#0/Config/ssh/Protocol" TCP
Oracle VM VirtualBox Command Line Management Interface Version 3.2.12
(C) 2005-2010 Oracle Corporation
All rights reserved.


C:\Program Files\Oracle\VirtualBox>VBoxManage getextradata "Solaris" enumerate
Oracle VM VirtualBox Command Line Management Interface Version 3.2.12
(C) 2005-2010 Oracle Corporation
All rights reserved.

Key: GUI/InfoDlgState, Value: 400,450,normal
Key: GUI/LastGuestSizeHint, Value: 720,400
Key: GUI/LastWindowPostion, Value: 265,101,720,442
Key: GUI/MiniToolBarAlignment, Value: bottom
Key: GUI/SaveMountedAtRuntime, Value: yes
Key: GUI/ShowMiniToolBar, Value: yes
Key: VBoxInternal/Devices/e1000/0/LUN#0/Config/ssh/GuestPort, Value: 22
Key: VBoxInternal/Devices/e1000/0/LUN#0/Config/ssh/HostPort, Value: 2222
Key: VBoxInternal/Devices/e1000/0/LUN#0/Config/ssh/Protocol, Value: TCP

C:\Program Files\Oracle\VirtualBox>netstat -na|findstr 22
TCP 120.28.9.137:3305 61.18.190.228:443 ESTABLISHED



C:\Program Files\Oracle\VirtualBox>netstat -na|findstr 22
TCP 0.0.0.0:2222 0.0.0.0:0 LISTENING
TCP 120.28.9.137:3305 61.18.190.228:443 ESTABLISHED