The
Darkpoint Technology Logo

Knowledge Base

Index

Home

 

How to port forward using ssh


Local Unix host

  • Issue the following command on your local Unix host:

ssh -g -L local_port:remote_host:remote_port  remote_host_to_log_in_to  -l  remote_login_id

This forwards all traffic from remote_port on remote_host to local_port on your local Unix host.

Example 1

ssh -g -L 8081:141.228.181.4:8081 141.228.181.4 -l root

This will make an ssh terminal session to 141.228.181.4 and will forward port 8081 on 141.228.181.4 to port 8081 on the local host.

Example 2

ssh -g -L 9000:141.228.181.4:8081 141.228.181.4 -l root

This will make an ssh terminal session to 141.228.181.4 and will forward port 8081 on 141.228.181.4 to port 9000 on the local host.

Example 3

ssh -g -L 9000:141.228.181.19:8081 141.228.181.4 -l root

This will make an ssh terminal session to 141.228.181.4 and will forward port 8081 on 141.228.181.19 to port 9000 on the local host. For this to work, 141.228.181.4 must be able to connect directly to port 8081 on 141.228.181.19

Note: the - g option allows users on other workstations to connect to the forwarded port on your local Unix host. If this option is not used, only processes on the local Unix host will be allowed to connect to the forwarded port.

Darkpoint Technology Ltd.   --  Company Number: 4019337   --  Vat Number: 760886104

.