SSH tunnel manager. Save, start, and manage local, remote, and dynamic (SOCKS5) port forwarding tunnels. Auto-reconnect, jump host support, and named configurations. Single binary, no dependencies.
Works on Windows, macOS, and Linux.
- Local forwarding (
-L) -- forward a local port to a remote host through SSH - Remote forwarding (
-R) -- expose a local service on a remote server - Dynamic forwarding (
-D) -- SOCKS5 proxy through SSH - Named tunnels -- save tunnel configs and start them by name
- Auto-reconnect -- automatically reconnects on disconnect
- Jump hosts -- connect through bastion/jump servers
- Key and password auth -- supports SSH keys (auto-detected) and passwords
Grab the latest binary from Releases and place it in your PATH.
go install github.com/jmsperu/tunl@latestgit clone https://github.com/jmsperu/tunl.git
cd tunl
make buildCross-compile for all platforms:
make build-all # outputs to dist/# Forward local port 3306 to a remote database through a bastion host
tunl start -L 3306:db.internal:3306 user@bastion
# Save it for later
tunl add db -L 3306:db.internal:3306 user@bastion
# Start by name
tunl up dbStart a tunnel immediately (not saved).
tunl start -L 3306:db.internal:3306 user@bastion # local forward
tunl start -R 8080:localhost:3000 user@server # remote forward
tunl start -D 1080 user@proxy # SOCKS5 proxy
tunl start -L 5432:pg:5432 user@bastion -J jump@gateway # via jump host
tunl start -L 3306:db:3306 user@host -k ~/.ssh/id_rsa # specific key
tunl start -L 3306:db:3306 user@host -p mypassword # password authSave a tunnel configuration for reuse.
tunl add db -L 3306:db.internal:3306 user@bastion
tunl add web -R 8080:localhost:3000 user@server -d "expose dev server"
tunl add proxy -D 1080 user@proxyStart a saved tunnel by name.
tunl up db
tunl up proxyList all saved tunnels.
tunl listRemove a saved tunnel.
tunl remove db| Flag | Short | Description |
|---|---|---|
--local |
-L |
Local forward (localPort:remoteHost:remotePort) |
--remote |
-R |
Remote forward (remotePort:localHost:localPort) |
--dynamic |
-D |
SOCKS5 dynamic port |
--key |
-k |
SSH private key file |
--password |
-p |
SSH password |
--jump |
-J |
Jump host (user@host:port) |
--desc |
-d |
Tunnel description (for add only) |
Tunnels are saved to ~/.tunl.yml:
tunnels:
db:
type: local
host: bastion.example.com
port: 22
user: admin
key_file: ~/.ssh/id_ed25519
local_port: 3306
remote_addr: db.internal
remote_port: 3306
auto_reconnect: true
description: Production database
proxy:
type: dynamic
host: proxy.example.com
user: admin
local_port: 1080
auto_reconnect: trueMIT