I have a crapboat of less-than-new computers that I've been hooking up to a small compute cluster because why not. I have a single master node that has a public IP address that these computers can all talk to. The worker nodes are behind a NAT. So, in order to converse with them all, I have them all create a reverse ssh tunnel into the master node on boot. Thus, they are each connected to the master at a different port. Each machine chooses a port n+1 where n is the previous machine's port number. In my ssh config on my laptop, I have the following:
Host worker*
ProxyCommand ssh master -W %h:%p
HostName localhost
Host worker001
Port 7001
Host worker002
Port 7002
....
#Host workerX
# Port 7000 + X
What I would like to do, is to have a single entry for my workers, so that workerX uses port 7000 + X. Is this possible with ssh config? If not, is there some other workaround to have this happen? Alternatively, can I "split" my ssh config, so that my ~/.ssh/config file doesn't have a hundred lines of workerX, and I can confine all of that mess?
ssh_configsupports theIncludedirective to answer the "Alternatively" part of the question. – Ginnungagap Aug 20 '19 at 21:11