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.

Im want to send traffic over to Host B on port 3000, i have access to all nodes in this drawing, the only port that is open between these two lans is port 80 from Linux Box B to Linux box A.

so i do a "ssh -R 1206:192.168.1.10:22 disp@10.10.10.10 -p 80", and ssh back trough the tunnel with "ssh -L 3000:10.10.10.10:3000 disp@localhost -1206"

if im correct this now listens to port 3000 on the Linux Box A and sends it to Linux Box B trough the tunnel to port 3000? are my logic correct?

how can i now route this traffic over to port 3000 on host B.

and if i want t two way connection "From B to A" how can this be done?

ssh tunneling

share|improve this question

1 Answer 1

up vote 1 down vote accepted

IMO your routing is/IP ranges are kind of weird but I guess that's not part of the problem.

I'm working a bit on guesses but I hope it's still of some help.

linux_box_b$ ssh -g -R *:3000:192.168.1.11:3000 disp@10.10.10.10 -p 80

now if you send something from host_a to linux_box_a:3000 it actually gets sent to host_b:3000. For this to work the sshd on Linux Box A has to allow GatewayPorts and AllowTcpForwarding

for the other direction use

linux_box_b$ ssh -g -L *:3000:192.168.1.11:3000 disp@10.10.10.10 -p 80

now Linux Box B listens on port 3000 an tunnels them to Host A port 3000.

With this solution though always the last part of the connection (between Host A and Linux Box A and on the other side Host B and Linux Box B) is not encrypted.

for an end to end encrypted tunnel you could use:

linux_box_b$ ssh -g -R *:10022:192.168.1.11:22 disp@10.10.10.10 -p 80
linux_box_b$ ssh -g -L *:10022:192.168.1.11:22 disp@10.10.10.10 -p 80

host_a$ ssh -L 33000:localhost:3000 -p 10022 10.10.10.10

host_b$ ssh -L 33000:localhost:3000 -p 10022 192.168.1.10

now each host (a&b) will have to use localhost:33000 as their sending destination.

HTH

share|improve this answer
    
'*' should be in quotes lest it get expanded by your shell. –  BMDan Oct 4 '10 at 17:51
    
might be... i'm using bash on Mac OS X and never had that problem, but as always with shell expansion you can never be careful enough. –  Marcel G Oct 4 '10 at 18:31
    
very nice, aye the IP ranges are weird and wrong i just picked random ips on the first lan, for the exsample, for easy reading, and the host A shold be 10.10.10.11 in the exsample not 192.168.1.11,,, got it working ty mate :) –  Darkmage Oct 5 '10 at 8:43

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.