../

SSH jump hosts

The problem

Let’s say you want need to connect to the host sunflower001 (ip 10.10.12.141), but the host is not visible from outside the network. One solution is to fire a VPN client and use the connection to connect from within. But VPN can be slow and cumbersome to use.

Another solution

If you have access to any another node that is both connected to sunflower001 and visible from the internet, you could use it as jump host. Let’s call this hypothetical node cuilxa.unige.ch. You could then simply connect from outside using the line:

$ ssh -J cuilxa.unige.ch 10.10.12.141

~/.ssg/config

If the line above did work, you can modify the .ssh/config present in your home adding the following lines:

Host cuilxa
  HostName cuilxa.unige.ch

Host sunf
  Hostname 10.10.12.141
  Proxyjump cuilxa 

The you can simply connect with:

$ ssh sunf

Everything should work just fine. Of course, to avoid entering the password each time, you should copy your key…

A door to a door, with number 22.

Vicar’s Close, Wells, United Kingdom. Copyright © 2017 Annie Spratt.