Ternux
Port Forwarding

Local Port Forwarding

Forward a remote port to your local machine over an SSH tunnel.

Local port forwarding maps a port on your local machine to a port on the remote server (or a host reachable from the remote server). This is the most common type of SSH tunnel.

Common use cases

  • Access a remote PostgreSQL database (5432) on localhost:15432
  • Reach a web UI behind a firewall via localhost:8080
  • Connect to Redis, Elasticsearch, or any other service not exposed to the public internet

Adding a local forward

  1. Go to Connections → Port Forwarding.
  2. Click New TunnelLocal.
  3. Fill in:
FieldExampleDescription
Connectionprod-serverThe SSH host to tunnel through
Local port15432Port on your machine
Remote host127.0.0.1Target host from the SSH server's perspective
Remote port5432Target port on the remote host
LabelProd DBFriendly name
  1. Save, then toggle the tunnel Active.

How it works

Your Machine          SSH Server            Target Service
localhost:15432  ─→  SSH channel  ─→  127.0.0.1:5432

While the tunnel is active, any connection to localhost:15432 is forwarded through the SSH channel to 127.0.0.1:5432 on the server.

Stopping a tunnel

Toggle the Active switch off on the tunnel card, or close the associated SSH session tab.

On this page