Access the http port on VirtualBox guest from host, such as to use Mac web browser to see site developed in Ubuntu virtual machine
Accessing web server on Ubuntu VirtualBox guest from Mac OS X host
Search words:
port sharing virtualbox
virtualbox localhost
virtualbox localhost ubuntu mac os x webserver
virtualbox localhost:8080
guestport hostport virtualbox
mac os x virtualbox port forwarding
VirtualBox 3.0 VBox 3
Ebony-II:~ ben$ VBoxManage setextradata "buntu" "VBoxInternal/Devices/e1000/0/LUN#0/Config/guestssh/Protocol" TCP
VirtualBox Command Line Management Interface Version 3.0.0
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.
VBoxManage setextradata "buntu" "VBoxInternal/Devices/e1000/0/LUN#0/Config/guestssh/GuestPort" 22
Ebony-II:~ ben$ VBoxManage setextradata "buntu" "VBoxInternal/Devices/e1000/0/LUN#0/Config/guesthttp/Protocol" TCP
VirtualBox Command Line Management Interface Version 3.0.0
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.
Ebony-II:~ ben$ VBoxManage setextradata "buntu" "VBoxInternal/Devices/e1000/0/LUN#0/Config/guesthttp/GuestPort" 80
VirtualBox Command Line Management Interface Version 3.0.0
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.
Ebony-II:~ ben$ VBoxManage setextradata "buntu" "VBoxInternal/Devices/e1000/0/LUN#0/Config/guesthttp/HostPort" 8080
VirtualBox Command Line Management Interface Version 3.0.0
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.
See what you're doing with:
VBoxManage getextradata "buntu" enumerate
How not to do it
A lesson learned-- the HostPort must be greater than 1024, because Linux doesn't let root bind to lower numbers.
Failed to start the virtual machine buntu.
NAT#0: configuration error: failed to set up redirection of 80 to 88. Probably a conflict with existing services or other rules (VERR_NAT_REDIR_SETUP).
Failed to attach the network LUN (VERR_NAT_REDIR_SETUP).
Unknown error creating VM (VERR_NAT_REDIR_SETUP).
Result Code:
NS_ERROR_FAILURE (0x80004005)
Component:
Console
Interface:
IConsole {0a51994b-cbc6-4686-94eb-d4e4023280e2}
Error when forwarding port 80: On Linux, only the root user can bind to a port below 1024.
http://www.virtualbox.de/ticket/922
Reference:
http://www.virtualbox.org/manual/UserManual.html#natforward
http://www.fliquidstudios.com/2009/06/18/creating-a-virtual-development-server-using-virtualbox/