Insights
SSH tunneling: How port forwarding works
Learn how local, remote and dynamic SSH forwarding work, where encryption ends, and how to check the listener and destination separately.

On this page
A Secure Shell (SSH) tunnel carries selected application traffic through an encrypted connectionOpens in a new tab between an SSH client and server. With local port forwarding, your app connects to a port on your device, and the SSH server connects to the service for you.
In short:
- Selected traffic. An SSH tunnel carries app connections without rerouting your whole device.
- Listener location. Choose a forwarding mode by where the app connects and who picks the destination.
- Three separate ports. Check the app’s listener, the SSH connection and the service port separately.
What travels through an SSH tunnel
SSH can carry a browser connection alongside a terminal session. Point your browser at a forwarded port, and that connection goes into SSH. Other traffic on your laptop keeps its usual route. The listener is the address and port where the app connects to enter the tunnel.
Which side should listen?
Use local forwarding when the app connects on your device, remote forwarding when it connects on the SSH server side, and dynamic forwarding when the app needs to pick its destinations.
| Forwarding mode | Listener location | Destination choice | When to use |
|---|---|---|---|
Local (-L) | SSH client | Fixed by you | Your laptop opens a private dashboard |
Remote (-R) | SSH server | Fixed by you | A server-side app needs a service on the client side |
Dynamic (-D) | SSH client | Chosen by the app | A proxy-aware app needs several destinations |
Dynamic forwarding creates a local SOCKS proxy, a relay that connects to destinations the app requests. Only apps you configure to use that proxy send traffic through it.
Which port does each connection use?
Suppose your laptop runs OpenSSH and can reach an SSH server over an authorized private route. In this example, the browser connects to the laptop’s loopback address at 127.0.0.1:4040, and the SSH client connects to the server on port 22Opens in a new tab. The server then connects to its own loopback address at 127.0.0.1:8080, where the dashboard is assumed to listen. All three are Transmission Control Protocol (TCP) ports, and the two loopback addresses refer to different machines: each points back to the machine using it.
Check the laptop listener first. If SSH connects but the dashboard doesn’t load, check your laptop’s list of listening sockets for the SSH listener on 127.0.0.1:4040. If it’s missing, check whether the forward started and whether another process already uses that port. A loopback listener shows that other devices can’t connect directly to that entrance, not that the dashboard is reachable.
Check the destination from the SSH server. Try the dashboard at 127.0.0.1:8080 from the server itself. If it doesn’t answer there, check that the dashboard is running and listening on that address and port. If it answers there but not through the laptop listener, check the forward’s destination and whether the SSH server permits the forward. In this example, a dashboard response in your laptop browser through port 4040 would confirm the application path. A successful SSH login alone confirms only that you reached the SSH server and authenticated.
Where does the encryption stop?
SSH encrypts traffic between its client and server. If the SSH server then connects to a service on another host, that separate connection doesn’t inherit SSH encryption. Protect that leg separately if it needs encryption.
Encryption doesn’t decide who can reach a listener. OpenSSH binds local forwards to loopback by defaultOpens in a new tab on the client and remote forwards to loopback by defaultOpens in a new tab on the server. Client settings control the local listener. On the server, GatewayPorts can let a remote forward listen beyond loopback, while PermitListen limits which addresses and ports it may use.
Even with a wider bind, other hosts need a network path and access rules that let them connect. Keep a private service’s listener reachable only by clients that need it. Widening the listener won’t fix a destination the SSH server can’t reach.
Where doxx.net fits. The doxx.net private network has an SSH preset that allows remote terminal access on port 22, but you still configure forwarding separately and your SSH server decides what it permits. If you want a private route to your SSH server, you can download the doxx.net appOpens in a new tab.