9

I know how to tunnel some port through remote machine using SSH. But now I have a problem I don't know how to handle. I have three machines:

1) [PC] This is my machine. From this one I can access other two.

2) [AS] This is the application server. It cannot reach any of the other two

3) [WS] This is the machine with webservice.

It looks like this:

  ╔======>[AS]
  ║         ║
  ║         ║
[PC]        X
  ║         ║
  ║         ║
  ╚======>[WS]

I need to get from [AS] to the [WS], so I want this path:

  ╔=======[AS]
  ║         
  ║         
[PC]        
  ║         
  ║         
  ╚======>[WS]

I have admin access on both [PC] and [AS]. I have no access to [WS].

Is something like this even possible?

What I have so far: I can do a reverse SSH tunnel from [PC] to [AS] using this command:

ssh -R 12001:localhost:22 root@AS

This puts me to the console of [AS] and I can ssh to [PC] on port 12001. I guess this is the necessary first step. But how do I create SSH bridge from [AS] to the [WS]?

1 Answer 1

6

From AS try: ssh root@PC -L 12001:WS:22

and then (still from AS - probably another session): ssh root@localhost -p 12001 and it will be tunneled to WS to port 22.

1
  • Thanks. This works. But I had to first do a reverse tunnel from PC to AS, because there's no access from AS to PC(see update). Anyway it's solved now. Thanks for reply. Jun 21, 2017 at 10:05

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .