SSH Tunnelling

SSH to Restricted Server via SSH Tunnel

If you have a server, Restricted_Server, which is only accessible via SSH from a gateway machine say, Gateway_Server, then to ssh to the Restricted_Server, the command you can use is

1. ssh -L 10000:Restricted_Server:22 Gateway_Server -N

The above command  says: create a ssh tunnel to the Gateway_Server and forward all localhost traffic on port 10000 to the Restricted_Server on its port 22.

2. ssh user@localhost -p 10000

Connect to the localhost as "user" on port 10000. Since the localhost port 10000 traffic gets forwarded to the Restricted_Server port 22, this allows us to connect to the Restricted_Server's ssh service

  • No labels

1 Comment

  1. Anonymous

Write a comment…