This question already has an answer here:
We have a remote Xen server running a lot of guest machines (on Linux), with only a couple of IPs available.
Each guest machine should be directly accessible by the SSH from the outer world.
Right now we assign a separate domain name to each guest machine, pointing to one of the few available IPs. We also assign a port number to that guest machine.
So, to access machine named
foo, one should do as follows:
$ ssh foo.example.com -p 12345
...And to access machine named
$ ssh bar.example.com -p 12346
bar.example.com point to the same IP.
Is it possible to somehow get rid of custom ports in this configuration and configure SSH server, listening at that IP (or firewall or whatever on server side), so it would route the incoming connection to the correct guest machine, based on the domain address, so that following works as intended?
$ ssh foo.example.com hostname # prints foo $ ssh bar.example.com hostname # prints bar
Note that I do know about
.ssh/config and related client-side configuration solutions, we're using that now. This question is specifically about a zero client configuration solution.