Tuesday, March 10, 2009

Technical tip: Setting up a Windows host + xVM + Ubuntu + a service

This post is a technical tip to install and run any service in Ubuntu Linux into a xVM (Virtual Box) that's running into a Windows server host (see the firgure below). Well, that's not difficult if the xVM uses the network interface of the Windows host (bridging) and another valid IP address independently. In that case, you can easily connect to the services running in Linux from either the Intranet or Internet. The tricky thing is doing the same when the xVM has a NAT IP address and it's not possible to assign another valid IP address to the Windows host.




With xVM is possible to configure the NAT interface of the virtual machine for connecting the services running in Linux via port forwarding. For that, just follow the next steps:


# VBoxManage setextradata "ubuntu01" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/apache/HostPort" 80

# VBoxManage setextradata "ubuntu01" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/apache/GuestPort" 80

# VBoxManage setextradata "ubuntu01" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/apache/Protocol" TCP


Change ubuntu01 by the name/id of your virtual machine, and apache and the port number by the corresponding service what you want to connect in.
To see the settings of the virtual machine:

# VBoxManage getextradata "ubuntu01" enumerate


Don't forget to open the corresponding ports in the Windows firewall.
Finally, shutdown the virtual machine and restart the xVM application. Next, start the Linux virtual machine and the services. That's all.

The nice thing is the virtual machine portability. You can clone and get up various Linux machines running different services, using the same IP address of the Windows host. That configuration is also useful for running services as JBoss.

--
Ricardo Seguel

No comments: