How do I create a “Nested ssh tunnel”?… here is a solution to the problem.
How do I create a “Nested ssh tunnel”?
I connect to the linux server through 2 more servers:
MyPC --(ssh)--> serverA --(ssh)--> serverB --(ssh)--> FinalServer
httpd runs on FinalServer and listens to 80
serverA/serverB only accepts port 22, sshd services
Is there a way to access FinalServer: on myPC like this
myPC> curl http://127.0.0.1:80
Hi , this is FinalServer Httpd Service!!
myPC>
Thank you very much!!
Solution
In principle, you only need to go through tunnel port 80 every time you ssh.
So, at each step: ssh-L80:localhost:80<next-host>
However, you won’t be able to tunnel port 80 (and all ports < 1024 without root), so you must use a different port for this.