Skip to content

Port forwarding

Port forwarding creates an encrypted tunnel between your device and a remote server, letting you reach services that are not directly accessible from where you are. Data enters one end, travels inside the SSH connection, and comes out at the other end.

Port forwarding is free on every plan, Free included.

ZestSSH supports three types of port forwarding. Each one answers a different question:

Type The question it answers SSH flag
Local “I want to reach a service over there from right here.” -L
Remote “I want to expose a service on my device to the server.” -R
Dynamic (SOCKS5) “I want to route my traffic through the server.” -D

If you are unsure which one you need, you almost certainly need Local. It covers nearly every real-world case.


Before you configure anything, ask yourself one question:

“Where is the service I want to reach, and where am I sitting right now?”

  • The service is on the remote side, and you are on your local device: Local forward.
  • The service is on your local device, and something on the remote side needs to reach it: Remote forward.
  • You want to browse or route arbitrary traffic through the remote server: Dynamic (SOCKS5).

If a forward “isn’t working,” confirm the type before anything else. Answer two questions:

  1. Where is the service you want to reach? On the server or its network means a Local forward. On your own device means a Remote forward.
  2. Who needs to connect to it? You, from your device, means Local. Something on the server side means Remote. Any app on your device routing its traffic through the server means Dynamic (SOCKS5).

If you cannot answer clearly, it is a Local forward. GatewayPorts on the server only ever matters for Remote forwards, so do not change it unless you have confirmed you need a Remote forward.

Imagine two buildings connected by a locked underground tunnel. You are standing in Building A (your phone or laptop). Building B is the SSH server.

  • Local forward: You drill a hole in the floor of Building A. Anything you drop into it slides through the tunnel and pops out at one specific room in Building B. You are pulling a remote service toward you.
  • Remote forward: You drill a hole in the floor of Building B. Anyone in Building B can drop something in, and it slides through the tunnel to one specific room in Building A. You are pushing a local service toward the server.
  • Dynamic (SOCKS5): Instead of drilling to one room, you install a switchboard in Building A. For each request, the switchboard decides which room in Building B to send it to.

Local forwarding: “reach a service on the server”

Section titled “Local forwarding: “reach a service on the server””

Use it whenever you need a web UI, database, or any TCP service that is only reachable from the server or its private network.

How it works in ZestSSH: ZestSSH opens a TCP listener on your device at the address and port you set (the source port). When anything connects to that listener, ZestSSH opens an SSH channel to the destination host and port on the remote side, then relays data in both directions. Every new connection gets its own SSH channel, so several programs can use the tunnel at once.

Scenario Source port Destination host Destination port Then open
Proxmox web UI at 192.168.10.10 8006 192.168.10.10 8006 https://localhost:8006
PostgreSQL on the server 5432 localhost 5432 Connect your DB client to localhost:5432
VNC on the server 5900 localhost 5900 Point your VNC viewer at localhost:5900
Grafana on a LAN host 3000 192.168.10.50 3000 http://localhost:3000
RDP to a Windows machine behind the server 3389 192.168.10.20 3389 Remote Desktop to localhost:3389
A router’s admin page 8080 192.168.10.1 80 http://localhost:8080

Note on the destination host: localhost there means the SSH server’s own loopback, not your device. If the service runs on the SSH server itself, use localhost. If it is on another machine the server can reach, use that machine’s address.


Every forward belongs to one saved host and runs over a live SSH session to that host. Where you create and start it depends on your device.

  1. In the side rail, under Manage, click Port forwarding. The page lists your rules on the left and has a new rule’s form open on the right.
  2. Click New rule (or start in the form that is already open).
  3. In Simple mode, under What do you want to do?, pick one:
    • Reach a service on the server (LOCAL): “For example, open a server’s web UI from this device”.
    • Share a service from this device (REMOTE): “For example, let the server use your local dev database”.
    • Browse through the server (DYNAMIC): “A SOCKS5 proxy, like a lightweight VPN”.
  4. Fill in Name, pick the Server (the host that carries the forward), then the ports: Port here (the port on this device) and, except for a SOCKS5 proxy, Port on server. Simple mode always reaches localhost on the server; to reach another machine on the server’s network, switch to Advanced.
  5. Under the fields, a picture of the tunnel shows both ends and says what the forward does, for example “While it runs, anything on this device that opens localhost:8080 reaches port 80 on web-01.”
  6. Turn on Start automatically if the forward should start whenever you connect to that host.
  7. Optional: turn on Let other machines reach it (see Letting other machines in).
  8. Click Save, or Save and start to start it at once. Under Same thing in OpenSSH, the matching ssh command is ready to copy.

Advanced mode shows the raw fields: Name, Host, Type (Local (-L), Remote (-R), Dynamic (-D)), Source (host and Source port), Destination (host and Destination port), and under Options Start automatically, Allow other devices on my network and Exit if forwarding fails, with the matching command under Command. An existing rule opens in Advanced mode. The trash button at the bottom of the form deletes the rule.

Above the list, Filter rules searches your rules, and All, Running and Stopped (each with its count) show the rules in that state. Each rule shows its kind (L, R or D), its name, via the host that carries it, starts when you connect when it starts by itself, what goes where (for example localhost:8080 → web-01:80), and Stopped, Running or Error. A running local forward has Open localhost:8080, which opens it in your browser (over https for ports 443, 8006, 8443, 9443 and 10443). Each rule has Start or Stop. Right-click a rule for Edit, Duplicate, Run on network…, Enable auto-start or Disable auto-start, and Delete.

If no session to the rule’s host is open when you click Start, ZestSSH asks Connect to (host)? and offers Connect & start, which opens the session and then starts the forward.

Select above the list, or Ctrl+click (Cmd+click on a Mac), selects several rules to Start, Stop, move, copy or delete at once. Rules whose host has no session are asked about once for all of them. See Selecting many items.

  1. Connect to your server.
  2. Tap the Port forward button (two arrows) in the session toolbar. The Port forwarding screen for that host opens.
  3. Tap Add.
  4. Optionally tap a preset: Web, Database or SOCKS. Presets appear only when you add a new forward.
  5. Pick Local, Remote or SOCKS5, then fill in the fields (see Fields explained).
  6. Tap Add, then tap the play button on the forward to start it.

A computer’s pop-out terminal window has the same Port forward button and screen.

Manage > Port forwarding (on a tablet, More > Port forwarding) lists the saved forwards of all your hosts, grouped by host. A forward shows green while it runs. Tap Add port forward to pick a host and create one, tap a forward to edit it, or delete it. A long press starts selecting forwards, to start, stop, move, copy or delete several at once. Forwards start from the session screen above, or by themselves when Auto-activate on connect is on.

A saved host’s editor has a Port forwarding section (on a computer, in the Network tab; on a phone, under Advanced options). Tap Add port forward to add a forward that is set to start when you connect. This dialog has no bind address field: its forwards listen on 127.0.0.1.


Remote forwarding: “expose a service to the server”

Section titled “Remote forwarding: “expose a service to the server””

Remote forwarding is the reverse of local forwarding. It opens a listening port on the SSH server and tunnels connections back to a port on your device.

This is uncommon. You would use it when you develop a web service on your laptop and someone with access to the server needs to reach it, or when a server-side program needs to call back to your device.

Important: The SSH server must have GatewayPorts set in its sshd_config for a remote forward to accept connections from hosts other than the server itself. Without it, the remote port is only reachable from the server.

See Remote forwards for how the fields map.


Dynamic forwarding (SOCKS5): “route traffic through the server”

Section titled “Dynamic forwarding (SOCKS5): “route traffic through the server””

Dynamic forwarding starts a SOCKS5 proxy on your device. Any application that supports SOCKS5 can route its traffic through the SSH connection, as if it were sitting at the server.

ZestSSH’s proxy follows RFC 1928, handles IPv4, IPv6 and domain name addresses, and uses no authentication.

See SOCKS5 proxy for browser setup and limits.


Every plan (Free included)
Local, Remote and Dynamic forwards Yes
Start a forward automatically on connect Yes
Saved forwards per host No limit
Forwards running at once 50 per session
Connections at once through one forward or proxy 128

A forward runs over a session, so the Free plan’s open-session limit (5 on a computer, 3 on a phone or tablet) still applies to the sessions that carry forwards. If opening a session for a forward would go past it, the notice says so.

In a team, a vault can turn port forwarding off. Then the forward does not start and the app says “Port forwarding isn’t allowed in this host’s vault.” See Vaults and roles.


The phone’s editor (and the computer’s pop-out window) uses these fields:

Field What it means
Nickname (optional) A label for your reference. Does not affect the tunnel.
Source port (or SOCKS5 port) The port on YOUR device. For a local forward, the one you connect to; for a remote forward, the one the server’s connections are handed to.
Destination host For a local forward, the host the tunnel reaches from the SSH server (localhost = the server itself). For a remote forward, the address the server listens on.
Destination port For a local forward, the port of the service on the destination host. For a remote forward, the port opened on the server.
Bind address The address on your device. For a local or SOCKS5 forward, where it listens: 127.0.0.1 = only your device, 0.0.0.0 = your network too. For a remote forward, the address on your side that the server’s connections are handed to.
Auto-activate on connect When on, the forward starts every time you connect to this host. On by default for a new forward on a phone.

On a computer, the same switch is Start automatically, and it is off by default for a new rule.

Start automatically, sync and shared hosts

Section titled “Start automatically, sync and shared hosts”
  • Whether a forward starts by itself, whether other machines may reach it, and a bind address other than 127.0.0.1, are each device’s own setting. Sync never changes them on another device: a forward that arrives by sync on a new device starts only by hand and listens on 127.0.0.1 until you change it there.
  • A forward that comes with a host someone shared with you also listens on 127.0.0.1 and does not start by itself.
  • On a computer, Run on network… limits a rule’s automatic start to one of your Networks. Pick All networks to remove the pin.
  • A host’s own choice for a forward on a network (Inherit, On or Off, in the host editor) goes over that: see Per-host overrides.
  • If the same host is open in two sessions, its automatic forwards start on the first one only.

On a computer, Let other machines reach it (in Simple mode) and Allow other devices on my network (in Advanced mode) are one switch, and it changes the forward ZestSSH runs as well as the command shown:

  • For a local or SOCKS5 forward, the forward listens on every address of this device, so other devices on your network can use its port (“On: other devices on your network can use :8080 on this one”).
  • For a remote forward, ZestSSH asks the server to listen on every address it has, so machines that reach the server can use the port, if the server’s SSH server allows it (GatewayPorts).

When you save a forward that other devices could reach, and it did not listen that way before, ZestSSH asks first: Let other devices reach this forward? “This forward will listen on 0.0.0.0, so any device that can reach this one over the network can use port 8080 and go through your SSH connection. Allow it only on a network you trust.” Choose Allow to keep it. The phone’s editor asks the same before it keeps a forward with a bind address such as 0.0.0.0.

Exit if forwarding fails only changes the ssh command under Command: “ZestSSH’s own forward always tells you when it could not start.”


  • If a forward cannot start, a notice says why: the port on this device is already in use, the device does not allow that port to be opened, the host refused to forward it, or too many forwards are running. On a phone’s session screen it names the forward and the reason, for example “Web UI did not start: Port 8080 on this device is already in use.”, with the details to copy.
  • If a forward runs but its connections get nowhere, a notice “(name): connections are not getting through” says whether the host passes no connections on (forwarding is turned off there, or not allowed for this account or key) or could not connect to where the forward leads, with what the host said. It appears once per forward, not for every retry.
  • These notices are in the notification bell, with Copy details for a report you can paste. See Notifications.

Swapping source and destination ports. For a local forward, source is YOUR side and destination is the REMOTE side. If you want to reach port 8006 on the server but set source to 8006 and destination to 8080, you connect to localhost:8006 on your device and the tunnel tries port 8080 on the server.

Using port 22 as a source port. If something already listens on that port on your device, the forward cannot start. Pick a high port like 8080 or 9090.

Forgetting that “localhost” as the destination host means the server. In a local forward, localhost is the SSH server’s own loopback, not your device.

Closing the SSH session. A session’s forwards stop when it ends. Keep the session open for as long as you need the tunnels. On iOS, putting the app in the background may also stop them (see below).

Choosing Remote when you mean Local. If you want to reach something on the server from your device, that is a Local forward.


Running ZestSSH as a background service or daemon is not supported

Section titled “Running ZestSSH as a background service or daemon is not supported”

ZestSSH is a windowed desktop and mobile app. There is no headless mode, no daemon or system service, and no command-line flag to run it without a window. Every tunnel lives inside an SSH session in the running app: when the app quits, the session and its forwards end with it.

What does exist:

  • Close to system tray (computer). Turn on Settings > General > Close to system tray (“Closing the window hides it in the tray. Sessions stay connected.”). Closing the window then hides it and keeps every session and forward running. Click the tray icon to bring the window back, or open its menu for Show window, Quick connect, a Connect to submenu of your monitored hosts, and Quit ZestSSH. With the setting off (the default), closing the window ends all sessions and quits, after a question first if Confirm before closing the window is on. With Auto-restore previous sessions on, the same tabs reopen at the next launch; they are not kept running in between.
  • Start automatically. A forward set to start automatically starts every time you connect to its host, so bringing a tunnel back is one connect away.
  • Android scheduled tasks run a command, snippet or workflow on a schedule, and the Android foreground service keeps open sessions going while the app is in the background. See Scheduled tasks and Android background automation.
  • zestssh:// links can open a saved host or run an automation. ZestSSH asks you before it connects or runs anything from a link. See Automation Overview.

For a tunnel that must stay up with no app running, run it with OpenSSH instead (for example ssh -N -L ... under systemd, or autossh).


On iOS, port forwards run while ZestSSH is open. The first time you add a forward on an iPhone or iPad, ZestSSH explains this (About port forwarding on iOS: “iOS ends port forwards while ZestSSH is in the background, so keep the app open while you use one.”) with Got it and Learn more, and the Port forwarding screen shows a reminder banner. To keep work going on the server while you are away, run it under tmux or screen there.


  • Local forwards: bind address options and more examples.
  • Remote forwards: when you need remote forwarding and how to set up the server.
  • SOCKS5 proxy: dynamic forwarding, browser setup and limits.
  • Jump host: combine jump hosts with port forwarding to reach nested private networks.