I have a laptop that can obviously be inside or outside of my home network at times. When I need to SSH into a machine inside of my network, the connection is fairly straightforward:
localhost $ ssh machinelearning
When I'm trying to access the machine from outside of my network, I then need to connect to my router, then SSH from there:
localhost $ ssh router.mytotallyuniquedomain.com
router $ ssh machinelearning
I remember there being a shortcut for doing the latter command in ~/.ssh/config
, but at the moment I can't remember what it is.
Is there a way for me to supply multiple hostnames or types of connections so that when I do this:
$ ssh machinelearning
SSH will first attempt to connect to the machinelearning
host in the local network and then attempt to tunnel in through router.mytotallyuniquedomain.com
, all without me having to type out the long hostname?
~/.ssh/config?
" – Naftuli Kay Mar 31 '14 at 16:42