Remote Tunneling to a Server
The concept is the same as local tunneling, but in reverse — the remote server gains access to your local machine’s services.
-R flag and provide:
- A remote port to listen on
- The local host IP or hostname to forward to
- The local port to forward to
localhost:8080 from a browser or curl on the remote server will serve content hosted on your local machine at port 8080.
Parameters
| Parameter | Description |
|---|---|
-R | Establish a remote tunnel to the remote server |
Remote Tunneling — Local Network
You can expose a local network service to the remote host.Using
0.0.0.0 as the bind address makes the remote port accessible from any interface on the remote server, not just localhost. This requires GatewayPorts yes to be set in the server’s sshd_config.