Ssh Tunnel Commands Generator
Fast, accurate and free online ssh tunnel command generator tool running directly in your browser.
-
1Enter data
Enter content, paste text or load a file from disk. -
2Click the button
The tool will immediately process your data in the browser. -
3Get the result
Copy the finished text or save the file to your device.
return "Result ready in 0.1s";
}
Rate this tool:
Related tools
Other tools you may find usefulSSH tunnel command generator - Build SSH tunneling commands
SSH tunnel command generatorhelps you create valid SSH commands for port tunneling - local forwarding, remote forwarding and dynamic (SOCKS proxy). Select the tunnel type and complete the parameters - the ready command will appear immediately.
What is SSH Tunneling?
SSH tunneling (SSH port forwarding) is a technique for forwarding network traffic over an encrypted SSH connection. It enables: access to services inaccessible from the outside (behind a firewall), secure connection to unencrypted protocols (HTTP, FTP, Telnet), creation of SOCKS proxies for anonymous browsing, remote access to databases and internal systems.
SSH Tunnel Types
Local forwarding (-L)- Forwards a local port to a remote host via an SSH server. Syntax:ssh -L local_port:remote_host:remote_port user@ssh_server. Example:ssh -L 8080:internal-db:3306 [email protected]- port 8080 locally accesses MySQL on internal-db via jumpserver.Remote forwarding (-R)- Forwards a port on the SSH server to your local machine. Example:ssh -R 8080:localhost:80 [email protected]- exposes your local server on port 80 via server.com:8080. Useful for demonstration and webhook testing.Dynamic forwarding (-D)- Creates a local SOCKS proxy.ssh -D 1080 [email protected]- configure the browser with SOCKS5 proxy 127.0.0.1:1080, all traffic goes through SSH.
Useful SSH flags for tunneling
-N- does not execute remote command (tunnel only, no shell).-f- runs SSH in the background.-C- data compression (useful for slow connections).-v- verbose (debug).-i key_file- the specific private key.-o ServerAliveInterval=60- keepalive so that the tunnel does not expire. Typical background usage:ssh -fNL 5432:db:5432 user@bastion.
Autossh - Automatic Tunnel Restore
Autossh monitors your SSH connection and automatically restores it after a break - essential for permanent production tunnels. Example:autossh -M 20000 -f -N -L 5432:db:5432 user@bastion. Port 20000 is the autossh monitoring port. You can manage autossh via systemd service for persistence after reboot.
Frequently asked questions
How to get to a MySQL database behind a firewall via SSH?
Create local forward:ssh -fNL 3306:db-server:3306 [email protected]. Then connect locally:mysql -h 127.0.0.1 -P 3306 -u dbuser -p. Your MySQL client will connect via SSH tunnel as if the database were local. Remember-h 127.0.0.1instead of localhost (localhost can use socket instead of TCP).
How to share a local development server over the Internet?
Remote forwarding:ssh -R 8080:localhost:3000 [email protected]. Anyone visiting public-server.com:8080 will see your local server on port 3000. RequiresGatewayPorts yesin sshd_config on the server. Alternatively, use tools like ngrok or Cloudflare Tunnel - easier to configure.
What is the difference between an SSH tunnel and a VPN?
SSH tunnel: works per-port, connectionless configuration, requires only SSH access, encrypts only tunneled traffic. VPN: routes all network traffic, works at the system level, requires a VPN client and server, more suitable for full access to the corporate network. For access to specific services behind the firewall - SSH tunnel. For complete "being in the company network" - VPN.
How to keep the SSH tunnel alive (prevent disconnection)?
Add to ~/.ssh/config:Host *\n ServerAliveInterval 60\n ServerAliveCountMax 3. Or in the command:-o ServerAliveInterval=60 -o ServerAliveCountMax=3. These options send a keepalive every 60 seconds and close the connection after 3 missed keepalives. For critical tunnels, use autossh or systemd socket activation.
Is SSH tunneling secure?
Yes - SSH uses strong encryption (AES-256, ChaCha20) and public key authentication. The tunnel is as secure as your private key. Always use key authentication (not password), keep your private key secure (passphrase encrypted), rotate keys regularly, restrict SSH access via AllowUsers and from= in authorized_keys.