0

I have 3 machines that are connected as a chain, A,B,C.

 A-->B-->C

A is my machine, B is server, and C is other machine with some services and web server on it. Because of some issues I need access from A to webserver on C (port 80), I can use ssh to login from A to B and then from B to C, but console at this moment is too less. I need web browser, and using ssh with option -X didn't work (some issues with dbus with Firefox start).

I make port forwarding on B using classic command to forward 22 port for ssh:

ssh -L 2222:localhostB:22 user@ipC

but using same to forward port 80 didnt work:

ssh -L 8888:localhostB:80 user@ipC

I know that there is some other forwarding to make it work, but I didn't understand how and what.

I need something like this:

A --> B (frd from B:8888 to C:80) --> C (port 80 web server)

so as effect when I type ipB:8888 I will be forwarded to C:80.

Any help as explain what have to be done, or scripts with command will be appreciated. I notice from one blog that it must be done two times ssh -L forwarding done, but I didn't understand why.

1

You're on the right track.

On A:

ssh -L 8888:ipC:80 user@ipB -N

Will make the web server on C accessible via localhost:8888 on A

A bit more details at the OPs request:

I've assumed from your question that you want to access the webserver of C on A (I'm guessing you have a GUI environment on A, with a web browser).

You can't access C directly (for whatever reason), but you can access B, which in turn can access C. So we create a tunnel between A and B, asking B to attach its end of the tunnel to the webserver on C

  • could You explain more detail why it is needed on A? – Mazeryt Jun 17 '15 at 10:00
  • because it goes through the ssh connection – JamesRyan Jun 17 '15 at 12:03

Your Answer

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

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