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

    • Minor Problems over the years with Windows 11 Pro on my original Intel 10700 Desktop i was using and not many problems on my Newer AMD Ryzen 7 7700X. Overall Windows 11 works extremely well, if don't do too many modifications, and do the regular security updates, and keep 3rd party apps up to date, and users shouldn't have any issues, and if a user does, should be a minor little issue that is easily fixable My goal is to have the 2 remaining household systems replaced for Windows 11 Compatible machines, hopefully by early September if not sooner.
    • Bill Gates says he'll donate 99 percent of his wealth to Africa by Hamid Ganji Microsoft co-founder and tech billionaire Bill Gates has pledged to donate a significant chunk of his personal wealth to African countries. As reported by the BBC, Gates's funding will be spent on improving health and education infrastructure in Africa over the next twenty years. The Gates Foundation has played an active role in improving public health and education in Africa over the past decades. Bill Gates aims to double down on that effort by donating most of his fortune to Africa. Last month, he also said that 99% of his fortune, which could exceed $200 billion, will go to African countries by 2045. Speaking at the African Union (AU) headquarters in Ethiopia's capital, Addis Ababa, Gates said, "By unleashing human potential through health and education, every country in Africa should be on a path to prosperity." The tech billionaire also told young African innovators to start relying on AI to improve health and education in their countries and use the technology to benefit the entire continent. He introduced Rwanda as a successful example of using AI in healthcare to identify high-risk pregnancies. "Africa largely skipped traditional banking and now you have a chance, as you build your next generation healthcare systems, to think about how AI is built into that," Gates added. By donating 99 percent of his personal fortune by 2045, Bill Gates can still maintain his position as one of the richest people on earth. According to Bloomberg, Gates's current net worth is around $175 billion. Gates's decision to donate 99 percent of his wealth to Africa came after the US administration cut USAID funding to African countries following the DOGE investigations. In a recent interview with the New York Times, Bill Gates called out Elon Musk for cutting the USAID budget, saying Musk has a role in the death of the poorest children on earth.
    • Very cool next level tech (for Witcher 4, CybePunk 2, etc.), but I'd be more impressed with seeing this at 4k than through a too low-bitrate YouTube ~1080p filter.
    • I was thinking, and was going to post, almost exactly what @Brandon Hjust posted!
  • Recent Achievements

    • Week One Done
      Adam Todd earned a badge
      Week One Done
    • Contributor
      Ed B went up a rank
      Contributor
    • One Month Later
      moporcho earned a badge
      One Month Later
    • One Month Later
      Parotel earned a badge
      One Month Later
    • Reacting Well
      Cryptecks earned a badge
      Reacting Well
  • Popular Contributors

    1. 1
      +primortal
      202
    2. 2
      snowy owl
      146
    3. 3
      ATLien_0
      133
    4. 4
      Xenon
      120
    5. 5
      +FloatingFatMan
      110
  • Tell a friend

    Love Neowin? Tell a friend!