Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have two computers both running Linux. Let's call them computer A and computer B. Computer A has IP 192.168.1.10 and B has 192.168.1.11.

On computer B there is a JBoss 7 AS installed and its admin interface is just accessable locally (on http://127.0.0.1:9990) and I would like to access it from computer A.

Therfor I would like to SSH tunnel to computer B from computer A and forward all traffic to another port that is open on B, let's say I would forward incomming HTTP requests on port 8081 on B to 127.0.0.1:9990.

How can I establish such a tunnel from computer A to computer B?

I followed this guide but failed: http://www.revsys.com/writings/quicktips/ssh-tunnel.html

share|improve this question

1 Answer 1

up vote 2 down vote accepted

On computer A:

ssh -fCNL 8081:localhost:9990 username@192.168.1.11

Or reverse port forward from computer B (don't use both simultaneously):

ssh -fCNR 9990:localhost:8081 username@192.168.1.10

For understanding the options see man ssh

share|improve this answer
    
Thanks! I will try that tomorrow at work. Will accept the answer tomorrow if I succeed. :-) –  Rox Nov 19 '12 at 18:08
    
On a normal network the -C option will just slow things down. –  rorycl Nov 19 '12 at 21:04
    
For me the CPU overhead from -C is negligible. Desktops and servers can handle gzip compression/decompression very easily and embedded devices usually turn off this feature. On the other size, network load is significantly lower especially on port forwarding (often is uncompressed/plaintext data). –  Dmitry Vasilyanov Nov 19 '12 at 22:25

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.