Simplest way to set up multiple subdomains to separate VMs running on single host

thomanil asked:


I´m planning to set up several virtualized centos, rhel or ubuntu guest machines on a single centos host server (most likely using KVM). Each guest VM is running an instance of a webapp + some other services/protocols, and each guest VM needs to be reachable from outside the host, on any open port, as if each of them was a separate, DNSed box.

I´m (apparently) weak in networking tech/config, so I am simply trying to find the first edges of this problem ie. the main approaches I need to look into to get a foothold on this. Networking config “pseudocode” if you will. 🙂


Let´s say I own the domain

I have a physical CentOS machine DNSed as

On this physical host machine I’ve got three VMs running. I want the guest VMs to be reachable as, and The guest VMs run centos, rhel and ubuntu distros.

Each VM needs to respond to any (locally open) port, not just http traffic, but also ssh connections and git: protocol operations.

Where do I start, what is the most elegant approach? What, roughly, does the host and guests each, minimally, need set up for this to work well?


I´ll update the question text + comments as I learn more.

My answer:

Hostnames can point anywhere. It’s unique global IP addresses for each VM that you need. (Make sure you actually have them; they can be very hard to get in some parts of the world.) Each virtual machine will require its own IP address, and if you want to reach them from the Internet, they must be global addresses.

The easiest way to do this is to use bridged networking for the VMs. How you set this up depends mostly on outside factors, such as whether you’re installing a VM control panel, but this howto will give you the basic steps to set up a bridge on your local machine so you can begin testing and become more familiar with how everything works.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.