SSH port forwarding is a mechanism in SSH for tunneling application ports from the client machine to the server machine, or vice versa.
Suppose we wish to visit a port in remote but behind the firewall, we can use SSH port forwarding to bind that port into local.
Assume the host in remote is "remote.example.com". Please visit the server in remote, and check the file "/etc/ssh/sshd_config", and make sure the option "AllowTcpForwarding" is not "no".
Since the default option for "AllowTcpForwarding" is "yes", you can simply ignore this option if you can not find this option.
And then, you can type the command in local as follow:
ssh -L 9090:localhost:9091 \ -L 9190:localhost:9191 \ username@remote.example.com
In this case, it will forward the stream from remote.example.com:9091 to localhost:9090, and from remote.example.com:9191 to localhost:9190.
Please refer to this page for more examples.
1 Comment
Alex · November 30, 2020 at 17:28
yes, tunneling is cool:
1. create local tunnel
2. check listening post
3. verify ssh process by its PID
4 . send HTTP request to 10.199.69.2 server via tunneling