Routing Same Port Traffic to Different VMs based on Subdomain?


Recommended Posts

I have a few friends that I help out with testing different web sites / server setups before going live on their own site/server. To do this, I have set up multiple Virtual Machines on a Mac OS X Client Host (using VMware Fusion). The problem I run into is how to ensure traffic is routed to the appropriate Virtual Machine based on the Subdomain used. For example...

post-36528-1234900358_thumb.png

Let's say I have set up the subdomain vm1.domain.com on a Linux Guest Virtual Machine. What I know is that Port 80 would come over the Internet into the Airport Extreme router, where all Port 80 traffic is sent to a DNS Server (I assume) to translate which subdomain needs to be routed which Internal/Private IP Address. In this example, the DNS Server sees vm1.domain.com and knows to send it to 10.0.22.100.

My question is this. Is this the correct process? If so, would it be wise to run a DNS Server on the Mac OS X client or use another Virtual Machine just for DNS routing.

If this process is incorrect, what is the best way to set this up with the equipment that is available to me (as shown in the graphic)?

The DNS server you are talking about is all routed through your internet router (which sends the requests to your ISP DNS servers), which then sends back to the original requester (the pc or vm within the network).

If you wanna use the same port on different vm's to serve some application then you will need more than one static IP from your ISP. As more than likely you will have only 1 IP address assigned to your account.

Once you have more IPS from your ISP, then you can go ahead and assign these IPs to your VM's and the forwarding of ports should be alright (you might need to configure this on your internet router, so that it routes the right ports to the correct device/IP on the network).

Well... poo. I was hoping THAT wouldn't be the answer. Since this is just for testing more than anything, I guess I'll just use different port numbers for each server as there is no way I can afford multiple IPs for just test servers. Real bummer.

Anyone wanna give a second opinion? :)

  Reb0ot said:
The DNS server you are talking about is all routed through your internet router (which sends the requests to your ISP DNS servers), which then sends back to the original requester (the pc or vm within the network).

If you wanna use the same port on different vm's to serve some application then you will need more than one static IP from your ISP. As more than likely you will have only 1 IP address assigned to your account.

Once you have more IPS from your ISP, then you can go ahead and assign these IPs to your VM's and the forwarding of ports should be alright (you might need to configure this on your internet router, so that it routes the right ports to the correct device/IP on the network).

There is no need for other "opinions" that was the correct answer.. To send the same port to muliple IPs behind a nat, you need multiple public IPs.

Now depending on the application that is no big deal, and your private sides can all listen on the same port... Lets say for example it was RDP.

your public IP is 24.1.1.1, your privates are 192.168.1.100, .101, .102

On your router you could forward say 3389 to .100, 3390 to 3389 on .101 and 3391 to 3389 to .103 -- That is if your router supports this, any decent one would. If not you would have to change each vm to listen on the different ports for the application.

So somone on the outside that wanted to connect to machine 1 for rdp could just use normal 3389 port, but if wanted to connect to machine 2 he would go to 24.1.1.1:3390 which the router would send to 192.168.1.101:3389

But wanting to setup multiple machines to provide the same service on the same port to the public.. Sorry You would need multiple public IPs, there is no way to tell DNS anything about what port to connect to, etc.

One option you would be able to use is setting up Apache on the host machine or one of the guests) to proxy the requests to the relevant private IP, open up port 80 to that instance of Apache, and users outside would know no difference.

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.