Tunnel a remote port to localhost through a jump host
With -o ProxyCommand
:
ssh -o ProxyCommand='ssh -W %h:%p -i myssh.key $user@$jumpserver_ip' -i myssh.key -L $local_port:$address_to_forward:$port_to_forward $user@$remote_ip
Or with -J
and the follwing ~/.ssh/config
:
Host <jumpserver_ip>
User <user>
IdentityFile /path/to/myssh.key
ssh -J $user@$jumpserver_ip -i myssh.key -L $local_port:$address_to_forward:$port_to_forward $user@remote