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.
  • Posts

    • ah yes, the person who thinks Bill Gates is a plant for Monsanto........
    • Meta announces 20-year nuclear energy partnership to support its data centres by Fiza Ali Meta announced a 20-year partnership with Constellation Energy today to secure nuclear power from the Clinton Clean Energy Center, reinforcing its commitment to clean energy for its data centre operations. Meta’s data centres lie at the heart of its global operations, powering everything from social media platforms to artificial intelligence technologies. As demand for AI accelerates, these facilities require vast and consistent amounts of electricity to maintain performance, reliability, and uptime. Meta currently matches its electricity consumption with 100% clean and renewable energy. As energy demands increase, particularly due to the growth of AI workloads, the company is incorporating additional energy sources such as nuclear power to maintain a consistent supply. Under the agreement, which begins in 2027, Meta will purchase 1,121 megawatts of emissions-free nuclear electricity from the Clinton plant in Illinois. The deal includes an additional 30 megawatts of capacity to the local grid and will help maintain the long-term operation of the facility without relying on state subsidies. It also supports over 1,100 local jobs and contributes $13.5 million annually in tax revenue. In parallel with the Constellation agreement, Meta is progressing its previously announced Request for Proposals (RFP) for new nuclear capacity. Since the RFP was launched early this year, the company has received more than 50 qualified submissions from utilities, developers, and nuclear-technology manufacturers spanning over 20 states. Meta has shortlisted several projects with the aim of developing between 1 and 4 gigawatts of new nuclear capacity. These projects are intended to accelerate development where execution is feasible and timelines are clear. Through both the Constellation agreement and its ongoing RFP process, Meta is positioning nuclear energy as a key component of its long-term energy strategy. This approach forms part of the company's "Tripling Nuclear Pledge," through which it aims to amplify the market for nuclear power in the United States.
  • Recent Achievements

    • Week One Done
      jrromero17 earned a badge
      Week One Done
    • One Month Later
      jrromero17 earned a badge
      One Month Later
    • Conversation Starter
      johnwin1 earned a badge
      Conversation Starter
    • One Month Later
      Marwin earned a badge
      One Month Later
    • One Year In
      fred8615 earned a badge
      One Year In
  • Popular Contributors

    1. 1
      +primortal
      223
    2. 2
      snowy owl
      156
    3. 3
      ATLien_0
      135
    4. 4
      Xenon
      127
    5. 5
      +FloatingFatMan
      125
  • Tell a friend

    Love Neowin? Tell a friend!