We have 3 machines.
- Client (192.168.1.12)
- JBoss (192.168.122.20)
- Apache (192.168.122.10)
SSH Port Forwardning from localhost:5555 to 192.168.122.20:8080.
Now test your tunnel by opening a web browser from client and enter http://localhost:5555/. The tunnel is:
localhost:5555 -> 192.168.122.20:8080
Now lets tunnel through apache server (192.168.122.10:22) to jboss server (192.168.122.20:8080).
The tunnel is now:
localhost:5555 -> 192.168.122.10:22 -> 192.168.122.20:8080
So every tunneling begins at the client, that opens the tunnel.