I've setup ssh and router port forwarding so I can ssh into a computer on my home network when I'm not at home. Currently I have two entries in my
.ssh/config file one for when I'm on my home network and one for when I'm not:
Host mycomputer HostName 192.168.X.X Host mycomputerathome HostName my.no-ip.dynamic
This works but I'm wondering if I can make things easier on myself. I was hoping there's a way to list multiple HostName entries such that if the first fails it falls back to the second:
Host mycomputer HostName 192.168.X.X HostName my.no-ip.dynamic
So that it will first try to connect to a host on my local network and if that isn't present, it'll try to connect using my no-ip dynamic host name. I have tried entering two HostNames but running
ssh mycomputer just blocks doing nothing.
I've turned off password authentication in favor of keys so accidentally connecting to a computer on the local network when I'm not on my home network shouldn't risk my password going anywhere it shouldn't.
Is it possible to specify fallback HostNames to try if the first one doesn't work?