I have three machines:
- I have physical access to
localhost - I want to ssh into
host1. However, it is behind carrier-grade NAT, so I can't ssh directly to it fromlocalhost relayhostis set up to help me connect fromlocalhosttohost1
I want to ssh from each localhost and host1 to relayhost, then have relayhost relay my ssh connection from localhost to host1.
This answer suggests I can create a tunnel on relayhost using ssh -L if I know the URI or IP address of host1. However, I don't know that because of the carrier grade NAT. So I can imagine a process to relay it like this:
- On
host1,ssh user@relayhost relayhostis watching for this connection and when it sees it says "I'm going to create a tunnel from my port 9999 to this connection"- On
localhost,ssh 9999:relayhost
Is this the right way to go about this? How do I do step 2?