Port forwarding and tunneling
This page explains how to set up and manage SSH port forwarding in Termius, including local, remote, and dynamic tunneling.
SSH port forwarding, also called SSH tunneling, can be used to get or provide access to services that are not directly reachable, encrypt connections between different applications, and more. See also: Port Forwarding (Ubuntu Community Help Wiki).
Termius supports all three main types of port forwarding (local, remote, and dynamic) and lets users manage their port-forwarding rules through a convenient interface. You can view all active port forwarding rules on a single page, and start or stop a specific rule with a double-click.
Local port forwarding
Concept: "I want to get access to a specific service that is unreachable from my current perspective."
For example, Daniel has a MySQL database server that is not reachable from his device with Termius, but is reachable from the daniel.local device, which is his office laptop. The laptop runs an SSH server and is reachable from Daniel's device with Termius. If Daniel sets up local port forwarding through an SSH connection to his office laptop, he will be able to get access the MySQL database server locally.
Here is how to set it up via Termius:
The resulting rule is equivalent to the following command:
ssh -L 127.0.0.1:3336:10.1.30.42:3306 daniel@daniel.localRemote port forwarding
Concept: "I want to provide someone with access to a service running on my machine or my private network."
For example, Bethany is developing a personal website on her laptop and wants Daniel to review it. Unfortunately, it is not accessible to Daniel, and she cannot change the router settings to make it accessible. Daniel has an SSH server running on his machine and suggests that Bethany set up remote port forwarding over the SSH connection to his server so he can access Bethany's website locally.
Here is how to set it up via Termius:
The resulting rule is equivalent to the following command:
Dynamic port forwarding
Concept: "I want my machine to act as a secure proxy for any destination."
This can be used to get access to a service that is unreachable locally, similar to the case with Local port forwarding
Or a SOCKS proxy can be used that will tunnel the traffic through the specified SSH connection, allowing secure access in untrusted networks
For example, using this technique, you can have a web browser use your SSH connection as a proxy, making your web connection requests appear to come from the remote server instead of your local device.
For that, you will need to specify
127.0.0.1:[selected local port]as the browser SOCKS proxy.
Here is how to set it up via Termius:
The resulting rule is equivalent to the following command:
Troubleshooting
If you followed the steps above but your port forwarding rule doesn't start, there are a couple of things you can check:
Make sure no other process is already using the forwarded port. On Windows, run
netstat -ant. On macOS and Linux, runnetstat -tolpn.If remote port forwarding does not work, make sure
GatewayPortsis set toyesin the remote SSH server configuration.
Last updated
Was this helpful?















