Port forwarding: local, remote and SOCKS tunnels

Create local (-L), remote (-R) and dynamic SOCKS (-D) tunnels through your SSH hosts, and choose which ones start automatically.

Port forwarding rules send network traffic through one of your SSH hosts. You manage them on the Port Forwarding page (⌘3 on a Mac).

Rule types

  • Local (-L): listens on this machine and forwards through the host to a destination, as the host sees it. For example, localhost:5432 on your computer can reach a database that only listens on the server. A destination of 127.0.0.1 means the server itself.
  • Remote (-R): listens on the remote host and forwards back to a destination reachable from your machine. You might use this to show a local dev server to the remote side.
  • Dynamic (-D): runs a SOCKS5 and HTTP proxy on this machine. Anything set to use it goes out through the host, and DNS is looked up there too.

Creating a rule

  1. Click New rule. This needs at least one SSH host.
  2. Choose the Vault, then enter a Label.
  3. Choose Local, Remote or Dynamic (SOCKS).
  4. Pick the SSH host.
  5. Set the Bind address and Local port. For Remote rules these are Remote bind address and Remote port.
  6. For Local and Remote rules, set the Destination host and Destination port.
  7. Click Save.

Keep the bind address at 127.0.0.1 so only this machine can use the tunnel. If you enter anything else, such as 0.0.0.0, Duo22 warns you that anyone on the network could use the tunnel or proxy.

Starting and stopping

Click the play button (Start) to start a rule and Stop to end it. The status shows starting, running (with the number of open connections), stopped or error. Hover over error to see the reason.

Locking the vault or quitting Duo22 stops every tunnel.

Starting automatically, per device

Start automatically after unlocking applies to this device only. The rule starts each time you unlock.

Rules can be shared through vaults. A shared rule can ask to start automatically, but on other members’ devices it shows auto-start requested and only starts once they click enable on this device. Click turn off on this device to stop it starting automatically here. If the rule listens on more than this machine’s own address, Duo22 asks you to confirm first.

Routing this device through a host

On desktop, a Dynamic rule has a globe button: Route this device’s traffic through it. It points this computer’s system proxy settings at the rule, so browsers and most apps reach the internet through that host.

  • It covers web traffic and other apps that follow the system proxy. UDP and many command-line tools (such as curl, git and ssh) ignore it. Point those at the rule’s port yourself, for example curl -x http://127.0.0.1:1080.
  • Your previous settings come back when you turn it off, stop the rule, lock the vault, quit, or the SSH connection drops. If Duo22 crashes, they’re restored the next time it starts.
  • macOS may ask for an administrator password.
  • Only one rule at a time can carry system traffic.

If a rule won’t start, see Troubleshooting terminals, SFTP and port forwarding.

Still stuck? Check the FAQ, or browse thehelp centre.