# Connecting two private hosts through a public pivot


A reverse ssh tunnel, from host1 to pivot

host1# ssh -R localhost:1337:localhost:1234 -f -N root@pivot
host1# nc -l localhost 1234

A proxy ssh tunnel, from host2 to pivot

host2# ssh -L localhost:1234:localhost:1337 -f -N root@pivot
host2# nc localhost 1234

Port forwarding and tunneling

[host2:r---host2:1234] => host2:x---pivot:22 => [pivot:s---pivot:1337]*
[pivot:s---pivot:1337]*=> pivot:22--host1:y  => [host1:t---host1:1234]

No comments: