For forwarding sshd_conf requires ```AllowTcpForwarding``` to be enabled which it is by default.
# Remote Forwarding
Forwards a defined port on the remote host back to the local host.
```bash
ssh -R REMOTELISTENPORT:127.0.0.1:LOCALPORT -N -f
[email protected]
ssh -R 8080:127.0.0.1:3000 -N -f
[email protected]
```
# Local Forwarding
***What you'll want most of the time***
Listen on local port and forward to a port on the remote host.
## Forward a Local Port to a Port on The Remote Host
```bash
ssh -L LOCALPORT:127.0.0.1:REMOTEPORT -N -f
[email protected]
ssh -L 5901:127.0.0.1:5901 -N -f
[email protected]
```
## Forward a Local Port to a Port on a Machine that the Remote Host Can See
```bash
ssh -L LOCALPORT:OTHER.HOST:OTHERHOSTPORT -N -f
[email protected]
ssh -L 5901:other.host:5901 -N -f
[email protected]
```
# Dynamic Forwarding - SOCKS
```sh
ssh -D [LOCAL_IP:]LOCAL_PORT [USER@]SSH_SERVER
```