March 14, 2014

SSH Port Forwarding

We have 3 machines.

  1. Client (192.168.1.12)
  2. JBoss (192.168.122.20)
  3. Apache (192.168.122.10)

SSH Port Forwardning from localhost:5555 to 192.168.122.20:8080.

$ ssh -L 5555:192.168.122.20:8080 root@localhost

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).

$ ssh -L 5555:192.168.122.20:8080 root@192.168.122.10

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.

No comments: