Page 1 of 1

An interesting routing problem

Posted: 30. Sep 2011, 23:04
by factor3
I have a host machine that I am going to want to run multiple VMs on. Though the question I will ask is generic enough to apply to any host, in my case my host machine is running Fedora 15. My VMs will likely be running various operating systems.

What I want to be able to do is run multiple VMs that, in turn are running software that listens on a particular port. For the sake of concreteness, let's say that my VMs are all listening on Port 8083.

The rub here is that while each VM is listening on Port 8083, each VM is running a different application. Again for the sake of concreteness, let's say that I have two VMs, one called "A" and the other called "B". Both are running Tomcat, and both are using Port 8083 to receive requests. The difference is the applications being run on these VMs. One application is an e- commerce app, while the other does a lot of picture sharing. In fact, I would like to have two different URLs associated with the two VMs.

My problem is this: I would like to open up a single port to the Internet (because I am going to eventually have several VMs and I don't want a lot of ports open on my outer firewall!), and have HTTP requests that come in on that port to be routed to my host machine. On my host machine, depending on the request URL, I would like to route the request to the appropriate VM.

Does VirtualBox provide some way of doing this? If not, can anyone suggest some software that I can put on my host to handle this problem?

Someone please advise.

Re: An interesting routing problem

Posted: 30. Sep 2011, 23:38
by Sasquatch
VirtualBox only provides in network access, not routing. From what you're describing, is something like a load balancer. It will listen on one port, but two urls, let's say vm1.yourdomain.org and vm2.yourdomain.org. They both point to the same IP address and port number, like a webserver serving multiple websites on different domains. The load balancer would then serve data from either VM1 or VM2 depending on the domain name used.

You can also install two instances of Tomcat and let it listen to the domain names, while maintaining the single IP and port configuration. Then you would need only one VM. You have to check the Tomcat configuration documentation for how to set it up like that.

In either way, this is not a VB question and should be asked in another forum more specialised in this kind of set up. You basically have two servers behind a single NAT router and you want to have them both accessible through a single TCP port.

Re: An interesting routing problem

Posted: 1. Oct 2011, 05:50
by factor3
Thanks for the info. I was uncertain whether or not this was something that VirtualBox solved. I am not a real expert in these matters.

Can you point me to where I should go to discuss this matter? I just need some clue as to what kind of software I am looking for...

Re: An interesting routing problem

Posted: 2. Oct 2011, 01:51
by Leak
factor3 wrote:I just need some clue as to what kind of software I am looking for...
Can't help you with discussing this, but the software you're looking for is called a reverse proxy - Apache or Lighttpd can do that, among other things.

In your case you could install the reverse proxy on the host and use it to route requests to the appropriate VM, or you could run the reverse proxy in a VM and use VirtualBox's internal networking to keep everything contained.

Re: An interesting routing problem

Posted: 2. Oct 2011, 21:02
by Sasquatch
factor3 wrote:Can you point me to where I should go to discuss this matter?
That would be the Apache website. Maybe they have a forum or mailing list you can ask your question.