Karachi   ->   Sweden   ->   Karachi, again   ->   Dubai   ->   Bahrain   ->   Karachi, once more   ->   London and Leeds

Sunday, December 07, 2008

Host and Guest Communication on Sun xVM VirtualBox

I recently installed Ubuntu 8.10 on a Sun xVM VirtualBox VM (running on Windows XP). Unlike VMWare Server, there is no direct/ default way of communication between the guest and the host. The solution, which I found after spending a few hours, is to establish port forwarding from the host to the guest. Please enlighten me if somebody knows a better way.

Sun xVM comes up with a command line tool vboxmanage. On my Windows host, it's located in C:\Program Files\Sun\xVM VirtualBox. You need to run the following three commands to establish port forwarding:

vboxmanage setextradata "Ubuntu" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestFTP/Protocol" TCP
vboxmanage setextradata "Ubuntu" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestFTP/GuestPort" 21
vboxmanage setextradata "Ubuntu" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestFTP/HostPort" 1121


Here, Ubuntu is the name of my VM. I have chosen guestFTP as the name of the service which will be forwarded --- you can replace this part with something of your choice. Essentially, the commands set three parameters: protocol, guest port and host port.