Reputation: 7600
I'm not sure if I'm using the right term of "port forwarding". What I want to do is connect to a local port that to connects to a remote server on a private network.
local --> jump-box --> server
On the server, a webserver is running on port 80 On local I would like to have my browser connect to localhost:8080 and reach the server's port 80. The jump-box is a standard port 22 ssh server.
Is this possible?
Upvotes: 3
Views: 2383
Reputation: 7600
I found the answer:
ssh <user>@<server ip> -o 'ProxyCommand ssh <user>@<jump box> nc <server ip> 22 2>/dev/null' -f -L <local port>:localhost:<server port> -N
for example
ssh [email protected] -o 'ProxyCommand ssh [email protected] nc web.local 22 2>/dev/null' -f -L 8080:localhost:80 -N
Upvotes: 2