1

I have the following scenario:

  1. A service listening on port 6678 on Computer C
  2. Only computer B can access computer C via ssh
  3. Computer B is accessible globally

I would like to do the following:

Setup a service on a Computer "A" that listens on port 6678 that would end up being redirected to computer "C" and to its listening service. I understand that I need to create an SSH tunnel through multiple hops. Such as A -> B -> C.

This question helped me a lot, but the problem is: It does not set a socket on "A" that may be accessed globally. I tried to mess around with ssh -D to set a binding socket, e.g.

ssh -D *:6678 -p 6678 localhost

but it does not seem to do a trick.

What would be the best option for creating a multiple-hop SSH tunnel and at the same time setup a listener on computer "A" to allow traffic to?

iamus
  • 11

1 Answers1

1

I think you are looking for:

ssh -g -L 6678:computerC:6678 computerB

If you run this on computer A it will open a port on computer A and traffic will be redirected to computer C using the ssh connection to computer B. This assumes that computer B can access port 6678 on computer C directly. You may want to try this without the -g option first if you only need access to computer C from computer A. If you need to grant access to computer C to multiple machines you will need the -g options and possibly and adjustment to your firewall rules.

chuck
  • 534