I have the following situation:
At home, I'm running an ssh server, on port 22 on one of my machines. I'd like to access it from the internet, so I port forward it. I make the external port 2222, so I don't get the normal wash of bots trying to hack upon port 22.
This works in practice well enough, however when I have a script or alias that tries to connect to these machines, I need to keep editing the port it tries to connect to, depending on whether I'm in or outside the network.
What's the 'best' way to fix this? Near as I can tell, some of my options are:
- Actually host ssh on 2222
- Somehow actually route local traffic to my router's port 2222, so it goes through the port forward options
- Different aliases/scripts depending on where I'm at (yuck).
Is there a better option I'm not aware of? I'll probably default to hosting ssh on 2222, if nothing else comes up.