0

I used to do the local port forwarding like below to access VNC server from local:

ssh -v -N -L 5902:target_server:5902 me@jump_host1

However, there is some change to my workplace that we cannot directly connect to jump_host1 using WiFi: we have to connect to another server guard and then connect to jump_host1 from guard.

Now, my question is how can I do the port forwarding in this case?

Thanks!

  • Already been answered superuser.com/questions/96489/an-ssh-tunnel-via-multiple-hops – marc Aug 31 '18 at 20:48
  • @marc I don't think so. In my case, there are 4 servers involved: my local, guard, jump_host1, target_server. If so, please shed lights on how I can adapt the answer there to my case. Tried all three options in the answer. None of them works for me. – zack Aug 31 '18 at 21:01
  • Having 3, 4 or 10 involved, doesn't change the fact of using the same explained principle as a foundation to solve the problem. – marc Aug 31 '18 at 21:06
  • @marc I see your point. However, my question is more on how the 4th server fit in the solution. Principle is good but I'd like to see more examples. Thanks! I have no interest with localhost2 mentioned in the solution because it will be a jump host in my case. – zack Aug 31 '18 at 21:12
  • In any case I would just use the ProxyJump directive, enabling you to add easily as much intermediaries as you like: en.m.wikibooks.org/wiki/OpenSSH/Cookbook/Proxies_and_Jump_Hosts – marc Aug 31 '18 at 21:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.