Port Forwarding
Termark has built-in port forwarding that reuses your existing SSH connection to set up local (-L), remote (-R), and dynamic (-D) forwarding — no extra tools needed.
Forwarding Types
Switch the forward type when creating or editing a rule:
- Local forwarding (-L): Maps a remote service reachable by the SSH host (jump host) to a local port. Common for reaching an intranet database or web service through a jump host.
- Remote forwarding (-R): Exposes a local service through the SSH host, letting remote end reach the local service via its port.
- Dynamic forwarding (-D): Listens on a local HTTP or SOCKS5 proxy port and routes traffic through the SSH host to target addresses. Useful as a temporary proxy.
The SSH host can be either a local host or a NextTerminal asset, selectable directly in the creation dialog.
Creating a Rule
- Open Port Forwarding and click Create in the top-right corner.
- Rule name (required): e.g. "Access remote MySQL".
- Forward type: pick local / remote / dynamic.
- SSH host (required): choose the SSH host or NextTerminal asset acting as the forwarding entry (jump host).
- Fill in ports and addresses per type:
- Local forwarding: local listen address and port, remote target address and port. The remote host is relative to the SSH host; use
localhostfor the SSH host itself (e.g. remote MySQL aslocalhost:3306, local listen3307). - Remote forwarding: SSH host listen address and port, local service address and port. The listen address defaults to
0.0.0.0; actual binding depends on the server GatewayPorts setting. - Dynamic forwarding: local listen address and port, proxy protocol (SOCKS5 or HTTP).
- Local forwarding: local listen address and port, remote target address and port. The remote host is relative to the SSH host; use
- Optional: enable Auto-start on launch (start this rule automatically when the app starts).
- Click Confirm.
Managing Rules
The rule list shows name, status, and the forwarding chain description, and can be searched by name, SSH host, target address, or port.
- Status: Running / Reconnecting / Stopped / Error. Click Stop while running; click Start while stopped.
- Active connections: for a running rule, view current connections (source address, listen address, opened at, duration), auto-refreshed every 2 seconds.
- Auto-start on launch: determines whether the rule starts automatically when the app starts.
- Edit / Delete: stop the rule first — running rules cannot be edited or deleted.
Configuration Examples
Access an intranet MySQL through a jump host
Local forwarding (-L)
Local listen: 127.0.0.1:3307
Remote host: localhost
Remote port: 3306After setup, mysql -h 127.0.0.1 -P 3307 locally reaches the intranet database.
Expose a local service to a remote end
Remote forwarding (-R)
SSH host listen address: 0.0.0.0
SSH host listen port: 9090
Local service address: 127.0.0.1
Local service port: 8080Once the server permits the specified bind address, it listens on 0.0.0.0:9090 and forwards through SSH to local 127.0.0.1:8080.
Use the SSH host as a temporary proxy
Dynamic forwarding (-D)
Proxy protocol: SOCKS5
Local proxy port: 1080Point your system or browser proxy to 127.0.0.1:1080 to reach the target network through the SSH host.
Remote forwarding: other devices cannot connect
If you entered 0.0.0.0 but the remote port binds to 127.0.0.1, check the SSH server GatewayPorts setting first. Termark sends the configured address, while the server controls the actual binding.
What GatewayPorts controls
| Value | Behavior |
|---|---|
no (default) | Restricts binding to loopback; only the SSH host itself can connect. |
yes | Forces wildcard binding regardless of the client address. |
clientspecified | Allows the client to select the bind address. Recommended for custom addresses in Termark. |
With clientspecified, use 127.0.0.1 for loopback, 0.0.0.0 for all IPv4 interfaces, a remote interface IP to restrict binding to that interface, or :: for IPv6 wildcard binding. These addresses belong to the remote server.
Check the effective configuration
Run on the remote SSH server:
sudo /usr/sbin/sshd -T | grep '^gatewayports'For configurations with Match User, Match Address, or Match Host, supply the connection details:
sudo /usr/sbin/sshd -T -C user=USER,addr=CLIENT_IP,host=CLIENT_HOST | grep '^gatewayports'Replace USER with the SSH username, CLIENT_IP with the client source IP seen by the server (the public exit IP when using NAT), and CLIENT_HOST with the client hostname.
Configuration usually lives in /etc/ssh/sshd_config or files referenced by Include. Trust the effective output of sshd -T. If the SSH service uses a custom configuration file, pass the same file with -f.
Allow the specified bind address
Set this in the applicable server configuration:
GatewayPorts clientspecifiedValidate syntax first:
sudo /usr/sbin/sshd -tNo output and a successful exit indicate valid syntax. Reload the appropriate service:
# Common on Ubuntu / Debian
sudo systemctl reload ssh
# Common on RHEL / Rocky / AlmaLinux
sudo systemctl reload sshdStop and restart the remote forward in Termark. Reloading SSH does not change an existing listener.
Verify the listener
For a remote port of 9090:
sudo ss -lntp 'sport = :9090'Check Local Address:Port: 127.0.0.1:9090 means loopback; 0.0.0.0:9090 means all IPv4 interfaces. If binding is correct but other devices still cannot connect, check the firewall, cloud security group, and network connectivity. GatewayPorts controls binding; it does not open firewall rules.
Notes
- Ports and addresses are validated (1–65535); invalid values cannot be saved.
- You must stop a rule before modifying or deleting it.
- Error status shows the specific reason, useful for troubleshooting port conflicts or unreachable remote ends.