1

I am attempting to forward traffic from port RP on remote host RH to port LP on my local box LH.

I have tried running

ssh -R (RP):localhost:(LP) -N user@(LH)

from the remote server. This creates an SSH tunnel, but it does not seem to do what I want it to. That is to say traffic to http://(RH):(RP)/webpage is returning a 404.

Is there any way I can check if and to where the traffic is forwarded?

It seems from some of the guides I have read that I need to set up tunneling on my local box, but that does not make any sense to me.

1 Answer 1

2

I found this site to have an excellent explanation of SSH port forwarding:

There are two types of tunnels, local (-L) and remote (-R), which are named after the entry point of the traffic.

You could start the tunnel from either end and forward appropriately; I'm going to demonstrate it starting from LH and setting up an entry port on RH.

In this case, you're saying you want to have traffic enter at RP on RH, and exit at LP on LH. If you think of it as a tunnel or pipe, then the entry ("ingress") port would be on RH, and the exit ("egress") port would be on LH.

The command you need to run (from localhost) should be:

$ ssh -R <RP>:<LH>:<LP> <RH>

This will connect to RH and ask ssh on that side to set up a listening port there on RP; the ssh process you just ran will then take those packets and inject them locally to LP on LH.

Note: If RP is <= 1024, you'll need to have root privileges on RH to start the tunnel.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .