hostname based routing

CarlFK

New Member
Sep 20, 2022
12
0
1
The goal is to host 4 or 5 websites for friends. all low traffic, so a single box should be fine. 16 cores, 32g ram, 1 nic, 1 public IP. hostname: prox

each site gets a VM, created manually, (they all get debian) add friends ssh keys and let them ssh in and do whatever they want in their vm. hostnames vm1, vm2... friends all manage their own domain name register / dns, point their www's at my IP, or do the thing that follows my prox hostname.

I would like to keep ports all standard: 22 for ssh, 80/443 for http/s, etc. and route to the VM based on hostname.

ssh user@prox gets the host, ssh user@vm1 gets vm1. curl http://vm1 gets vm1.

Is this reasonable, how do I do it, or how should I be doing it? I'm guessing it is all nftabels.conf, but would like some hand holding so I don't invent a square wheel and do this the hard way.

I like ansible, and eventually I'll use it, but first I want to know what i am doing.
 
you can host multiple websites behind a single IP via the use of a reverse proxy such as nginx. However, other protocols such as SSH don't have header information containing a hostname that could be used to direct incoming traffic.

The only way that I know of that would allow ssh access to multiple clients is to route by IP or port - so you could NAT incoming traffic from 1.2.3.4 to vm1 while traffic from 4.3.2.1 would go to vm2 or you would route incoming traffic on port 2222 to vm1 but traffic on port 2323 would go to vm2.