SSH jump host

An alternative to SSH tunneling to access internal machines trough gateway is using jump hosts.

The idea is to use ProxyCommand to automatically execute ssh command on remote host to jump to the next host and forward all traffic trough.

Prerequisites

 * SSH access to the gateway machine and the internal one
 * Gateway machine has Netcat installed

Usage
If usernames on machines differ, specify them:

You can give also port numbers if needed:

It works with scp command, too:

Tips
To ease the connecting even further:
 * Set these commands as shell aliases
 * To avoid typing passwords use OpenSSH keys

Multiple jumps
The same syntax can be used to make jumps over multiple machines:

Links

 * SSH through jump hosts