Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Please can someone explain the following command

ssh -L :8080:localhost:8080

Is it a ssh forward tunnel or reverse tunnel or port forwarding?

share|improve this question
up vote 2 down vote accepted

It should read

ssh -L 8080:localhost:8080

Though the extra colon may be ignored and not cause a problem.

What this is saying is "open port 8080 on the ssk client machine and direct any traffic received to the ssh server on port 8080".

Once you have established a the ssh session, a tunnel will be created from the PC you are on to the server you are connecting to on port 8080 at both ends.

The first 8080 is the local port.

localhost:8080 is the remote host and port that traffic received on local port 8080 should be directed to. Note that it doesn't need to be the remote machine itself, it can be any machine that the server can access.

So yes this is a tunnel.

share|improve this answer
thanks, it is good answer. Do you know what's reason behind someone want to do this forward tunneling? it is strange that direct all the traffic to the localhost:8080... – Kit Ho Nov 3 '11 at 3:01
This is usually done where there is a service that cannot be accessed directly because it is firewalled or has other restrictions. It is used regularly. In this case, if the remote host only allows access on port 22 (ssh), but the user wants to access a service listenin on 8080, the above command will let them access the service as if it were on their own machine on port 8080. – Paul Nov 3 '11 at 3:18
Thanks! that's cool – Kit Ho Nov 3 '11 at 3:26

It is a forward tunnel from port 8080 of the local machine to localhost:8080 on

share|improve this answer

You must log in to answer this question.

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