SSH forwarding
Create listeners on an existing SSH connection. A listener and its destination belong to different sides of the SSH transport.
Choose a direction
| Kind | Listener | Destination reached from |
|---|---|---|
| Local / forward (L) | Operator machine | SSH server |
| Remote / reverse (R) | SSH server | Operator machine |
| SOCKS (D) | Operator machine | SSH server; each client chooses a destination |
flowchart LR accTitle: Local and reverse forwarding accDescr: A local listener sends traffic through SSH to a destination reached from the server. A remote listener sends traffic through SSH to a destination reached from the operator machine. subgraph L[Local forward] LC[Local client] --> LL[Local listener] --> LS[SSH server] --> LD[Remote destination] end subgraph R[Reverse forward] RC[Remote client] --> RL[Remote listener] --> RO[SSH operator] --> RD[Local destination] end
For reverse forwarding, destination 127.0.0.1 means the operator machine.
Create a listener
# Reach a service from the SSH server through local port 8080.
tunnel create gateway forward 8080 localhost 80
# Expose a local service through remote port 3000.
tunnel create gateway reverse 3000 127.0.0.1 3000
# Ask for a random high remote port.
tunnel create gateway reverse 0 127.0.0.1 3000
These are alternatives; review the endpoint you intend to expose. The TUI opens a recap; Escape creates nothing. A standalone CLI call returns a review. Repeat that creation with --yes --review HASH to bind approval.
A port-only listener binds to 127.0.0.1. Select another literal address with IP:PORT, or [IPv6]:PORT. Broad binds expose the service to other hosts. Destination IPv6 arguments are bare addresses.
Ports are 1–65535; reverse LISTEN 0 requests a random port. Burrow attempts actual allocation in 49152–65535, up to eight candidates. Inventory preserves requestedListen and reports the allocated endpoint.
Inspect and check traffic
tunnel list
tunnel check gateway/CREATION_ID
Use the complete ID returned by inventory, not a port or table row number. IDs bind one creation. L and R identify the listener side; SOCKS inventory remains separate.
Allocation proves a listener exists, not that its destination works. Test with the service's normal client on the listener side. tunnel check waits for a passive greeting, sends no application command and discards the received byte. Silent services can be inconclusive.
Reverse exposure requirements
- A Linux SSH server with readable
/proc/net/tcpand, when enabled,/proc/net/tcp6. - Shell access and
awk/odfor observing actual bind addresses. - Compatible server forwarding permissions. A broad requested bind normally requires
GatewayPorts clientspecified.
Unexpectedly narrowed or widened binds are refused and cancelled. Exposure can differ briefly between allocation and verification. Kernel-table observation is not a firewall or Internet-reachability assessment.
The passive reverse check also needs a server-origin forwarding channel. A server permitting only remote forwarding may serve remote clients while refusing that diagnostic channel.
Remove and recover
tunnel remove gateway/CREATION_ID
Review and confirm removal. It stops new connections to that listener; accepted streams may finish. Siblings and the SSH master remain. Keep-running quit retains listeners; connection close ends all of them. Reconnect never recreates them.
Occupied ports are refused without replacing siblings. Uncertain allocation or cancellation remains unverified. Inspect before retrying; explicitly close the connection if cleanup cannot be verified.
Compatibility aliases
tunc gateway l 8080 localhost 80
tunc gateway r 3000 127.0.0.1 3000
tund gateway/CREATION_ID
Aliases share the same validation and reviews. tunnel remove does not accept --review; use its own advertised approval flow.
See SOCKS, selected-tunnel HTTP chains and the tunnel API.