Connect to a VirtualBox guest machine with SSH and HTTP

AttachmentSize
debian_drupal_testing.xml4.38 KB

You can easily setup a VBox VM to allow ssh and http connection from your host machine. See http://sk.c-wd.net/wp/2008/01/05/virtualbox-port-forwarding-with-linux-h... and http://mydebian.blogdns.org/?p=111

Run the following:

VBoxManage setextradata "guestname" "VBoxInternal/Devices/e1000/0/LUN#0/Config/ssh/HostPort" 2222
VBoxManage setextradata "guestname" "VBoxInternal/Devices/e1000/0/LUN#0/Config/ssh/GuestPort" 22
VBoxManage setextradata "guestname" "VBoxInternal/Devices/e1000/0/LUN#0/Config/ssh/Protocol" TCP

VBoxManage setextradata "guestname" "VBoxInternal/Devices/e1000/0/LUN#0/Config/www/HostPort" 8080
VBoxManage setextradata "guestname" "VBoxInternal/Devices/e1000/0/LUN#0/Config/www/GuestPort" 80
VBoxManage setextradata "guestname" "VBoxInternal/Devices/e1000/0/LUN#0/Config/www/Protocol" TCP

On MacBook Pro, these are the settings as they appear in Library/VirtualBox/Machines/guestname/guestname.xml:

      <ExtraDataItem name="VBoxInternal/Devices/e1000/0/LUN#0/Config/ssh/GuestPort" value="22"/>
      <ExtraDataItem name="VBoxInternal/Devices/e1000/0/LUN#0/Config/ssh/HostPort" value="2222"/>
      <ExtraDataItem name="VBoxInternal/Devices/e1000/0/LUN#0/Config/ssh/Protocol" value="TCP"/>
      <ExtraDataItem name="VBoxInternal/Devices/e1000/0/LUN#0/Config/www/GuestPort" value="80"/>
      <ExtraDataItem name="VBoxInternal/Devices/e1000/0/LUN#0/Config/www/HostPort" value="8080"/>
      <ExtraDataItem name="VBoxInternal/Devices/e1000/0/LUN#0/Config/www/Protocol" value="TCP"/>

I've also attached a complete guestname.xml file for the records.

Add new comment