ssh port forwarding

Used to forward ports from a client machine to a remote destination or vice versa. Also known as ssh tunneling.

local forwarding

ssh -L 8080:imgur.com:80 user@test.com

This would forward any connection to port 8080 on the SSH client to imgur port 80 through test.com.

local port forwarding diagram

remote forwarding

ssh -R 5900:localhost:3000 test@guest-pc

In remote forwarding, connections from one remote server are sent to another. The syntax is very similar to local forwarding and it works in reverse. In the above example, connections on guest-pc port 5900 would be forwarded to the local SSH client on port 3000