I want to ssh to Server-A which only accepts connections on port 1234. This port is blocked on my current network's firewall.

Server-B however, accepts ssh connections on standard port 22, and is able to reach Server-A via ssh on the alternate port 1234.

How can I create an ssh tunnel which will allow me to connect directly to Server-A on port 1234 using Server-B as a proxy?

closed as off-topic by Zoredache, EEAA, Andrew, Ward, squillman Sep 20 '13 at 2:54

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions must be relevant to professional system administration. Server Fault is a site dedicated to professionals; novice questions are off-topic. Please see the Help Center for more information on topicality. The best advice we can give you is to hire a professional to help you out." – Zoredache, Andrew, Ward
If this question can be reworded to fit the rules in the help center, please edit the question.

  • thank you! I added "ProxyCommand ssh -qxT Server-A netcat Server-B 1234" to my ssh config and this works perfectly. Am still curious about ssh tunnels which I don't really understand, or any other alternative methods if they exist. – billynoah Sep 19 '13 at 19:37
  • Read the linked questions? There are answers that solve the problem with tunnels. – Zoredache Sep 19 '13 at 19:40
  • 3
    This question appears to be off-topic because it is about policy circumvention. Talk with your IT department if you need access to something the firewall doesn't currently permit. – EEAA Sep 19 '13 at 19:43

Check this out:

ssh -L 12345:www.google.com:80 root@serverb

After doing this, you should be able to go to your browser and type localhost:12345 and www.google.com should come up. Hopefully that helps.

  • Thanks but how could you apply this to the above question? i.e., establishing an ssh connection, not an http browser connection. Sorry I just don't understand tunneling that well. – billynoah Sep 20 '13 at 0:43
  • Yes... The samething works, but instead of www.google.com put that location that you desire. If you want services on another server, then that would be the way to forward the services from that server to you locally. – Jay Sep 20 '13 at 15:04

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