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

    • Vivaldi 7.4.3684.52 by Razvan Serea Vivaldi is a cross-platform web browser built for – and with – the web. A browser based on the Blink engine (same in Chrome and Chromium) that is fast, but also a browser that is rich in functionality, highly flexible and puts the user first. A browser that is made for you. Vivaldi is produced with love by a founding team of browser pioneers, including former CEO Jon Stephenson von Tetzchner, who co-founded and led Opera Software. Vivaldi’s interface is very customizable. Vivaldi combines simplicity and fashion to create a basic, highly customizable interface that provides everything a internet user could need. The browser allows users to customize the appearance of UI elements such as background color, overall theme, address bar and tab positioning, and start pages. Vivaldi features the ability to "stack" and "tile" tabs, annotate web pages, add notes to bookmarks and much more. Vivaldi 7.4.3684.52 changelog: [Address bar] URL is searched instead of opening (VB-117198) [Chromium] Update to 136.0.7103.179 [Settings][Workspaces] Add Workspace Rule button hidden by 4th rule (VB-117181) Download: Vivaldi 64-bit | 125.0 MB (Freeware) Download: Vivaldi 32-bit | ARM64 View: Vivaldi Home Page | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • NTLite 2025.06.10482 by Razvan Serea NTLite is a Windows configuration tool that allows you to modify your existing Windows install or an image yet to be deployed, remove Windows components, configure and integrate, speed up the Windows deployment process. Reduce Windows footprint on your RAM and storage drive memory. Remove components of your choice, guarded by compatibility safety mechanisms, which speed up finding that sweet spot. Windows Unattended feature support, providing many commonly used options on a single page for easy setup. Easily integrate a single or multiple drivers, update or language packages. Package integration features smart sorting, enabling you to seamlessly add packages for integration and the tool will apply them in the appropriate order, keeping hotfix compatibility in check. One of the important new features of NTLite (compared to its predecessors) is the ability to modify an already installed the operating system, by removing unnecessary components. Supports Windows 11, 10, 8.1 and 7, x86 and x64, live and image. Server editions of the same versions, excluding support for component removals and feature configuration. ARM64 image support in the alpha stage. Does not support Checked/Debug, Embedded, IoT editions, nor Vista or XP. NTLite 2025.06.10482 changelog: Fix Image: Image optimization would be skipped if both boot.wim and install.wim would keep only one edition Image: Crash after exporting unloaded image in certain situations Upgrade UI-Translation: Thanks for Turkish (Salih DURDU), Georgian (Anonymous) Download: NTLite 64-bit | 21.5 MB (Free, paid upgrade available) Download: NTLite 32-bit | 19.3 MB Link: NTLite Home Page | NTLite Features | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • CrystalDiskMark 9.0.1 is out.
    • Wonder if the HDMI Forum will allow AMD to use HDMI 2.2 under Linux.
    • Where did you hear visio is discontinued? It's still available and being updated on Office 365 and even has an online free version now too.. and dont tell me because visio 2021 has EOL listed a Oct 13, 2026.. they have a beta version right now for visio 2026
  • Recent Achievements

    • Week One Done
      Wayne Robinson earned a badge
      Week One Done
    • One Month Later
      Karan Khanna earned a badge
      One Month Later
    • Week One Done
      Karan Khanna earned a badge
      Week One Done
    • First Post
      MikeK13 earned a badge
      First Post
    • Week One Done
      OHI Accounting earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      690
    2. 2
      ATLien_0
      264
    3. 3
      Michael Scrip
      201
    4. 4
      +FloatingFatMan
      167
    5. 5
      Steven P.
      138
  • Tell a friend

    Love Neowin? Tell a friend!