Search code examples
sshdebianwebserverssh-tunnel

SSH tunnel to remote site


I have three servers, one with white IP (SERVER1) and another(SERVER2 192.168.1.50) in my local net connect to Internet through provider net like 10.10... Also in my local net I've my another mini-server (SERVER3 192.168.1.51). I cannot work with SERVER3 with ssh.

So, I want: run in SERVER2 command "curl http://localhost/json:3333" and get answer from SERVER3 like in my home net: http://192.168.1.51/json.

For that: In SERVER2, I open ssh tunnel with command: "ssh -N -R 3333:192.168.1.51:80 admin@SERVER1"

And I have tunnel now in SERVER1, I send 'curl http://localhost:3333' and have right answer from http://192.168.1.51/index.html, but if I want to get any page I got fail, for sample: http://localhost/json:3333' will return 'Apache/2.4.25 (Debian) Server at localhost Port 80'

How I can tunneling all SERVER3 site with path and pages?


Solution

  • Simple mistake, right command must be http://localhost:3333/json'