I need a SSH tunnel from my home to private IP 10.4.100.6 as diagrammed here:
+-------+ +-----------------+ +------------+ +-------------+
| | | | | | | |
| Home +----+ foo.example.com +--+ 10.4.100.5 +--+ 10.4.100.6 |
| | | | | | | |
+-------+ +-----------------+ +------------+ +-------------+
I have root access on 10.4.100.5 and 10.4.100.6. I have zero access to foo.example.com. When I ssh to foo.example.com, I somehow land on 10.4.100.5, which is a different host. We're talking about 4 separate hosts. I assume foo.example.com uses one-to-one NAT.
I tried:
ssh -L 8080:10.4.100.6:80 [email protected]
No luck. Any tips?
Edit: It turns out the tunnel works, but not for websockets. Connections to ws://localhost:8080
fail with this:
<snip> WebSocket connection to 'ws://localhost:8080/' failed: Error during WebSocket handshake: Unexpected response code: 200
I didn't realize this at first. I thought the connection just hung.
Edit 2: My apologies, but I figured this out. I didn't realize that the app involves 2 servers: nginx on port 80 and a websocket server on port 8080. I created 2 separate SSH tunnels, and all works now. I got confused because the local port I chose, 8080, was also the port used by the remote websocket server.
Summary: nothing special is required to create a SSH tunnel through one-to-one NAT.