Sunday, January 25, 2009

Mac X: Port forwarding from Host OS to guest OS in VirtualBox 2.0.2

I run ubuntu-server on my VirtualBox 2.0.2. In order to run ubuntu-server on my VirtualBox I followed this site. The reason is that Ubuntu-server uses PAE (physical address extension) which is not supported in VB (this feature is still in beta in VB). Once this has been fixed, I was able to connect to web server running within VB from my Mac OS. For this I used the following commands in Mac X:
VBoxManage setextradata "ubuntu-server" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/Apache/Protocol" TCP

VBoxManage setextradata "ubuntu-server" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/Apache/GuestPort" 80

VBoxManage setextradata "ubuntu-server" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/Apache/HostPort" 8080
To remove this forwarding just execute the same commands without 80,8080 and TCP.


The same should work in windows xp. Command netstat -a shows connections.

When porting VB ubuntu-server from Mac X to Windows XP, there was a problem with VB - no internet. I run dhclient and change entry in /etc/network/interface. After that internet in VB was working, and web server also.