Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Please can someone explain the following command

ssh -L :8080:localhost:8080 root@test.abc.com

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

share|improve this question

2 Answers 2

up vote 2 down vote accepted

It should read

ssh -L 8080:localhost:8080 root@test.abc.com

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 test.abc.com.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.