• Latest
  • Trending
  • All
SSH Tunnel Command Generator: Local, Remote and Dynamic Forwarding - cover image

SSH Tunnel Command Generator: Local, Remote and Dynamic Forwarding

June 14, 2026
ssh command cheatsheet

SSH Command Cheatsheet: Connect, Keys, scp, Tunnels (2026)

June 16, 2026
chmod-chown-cheatsheet

chmod and chown Cheatsheet: Linux Permissions, Decoded (2026)

June 16, 2026
systemctl-journalctl-cheatsheet

systemctl + journalctl Cheatsheet: Services and Logs (2026)

June 16, 2026
grep-cheatsheet

The grep Cheatsheet: Search a File, Search a Tree (2026)

June 16, 2026
rsync-cheatsheet

The rsync Cheatsheet: Mirror, Sync, Copy Over SSH (2026)

June 16, 2026
curl-cheatsheet

curl Cheatsheet: Download Files and Test APIs (2026)

June 16, 2026
iptables-vs-nftables-cheatsheet cheatsheet

iptables vs nftables: Linux Firewall Cheatsheet, Side by Side

June 16, 2026
nmcli-cheatsheet cheatsheet

nmcli Cheatsheet: Wi-Fi and Network Connections From the Linux Terminal

June 16, 2026
powershell-networking-cheatsheet cheatsheet

PowerShell Networking Cheatsheet: Test-NetConnection, IP, DNS (2026)

June 16, 2026
tar command cheatsheet

The tar Command Cheatsheet: Create, Extract, Stop Guessing (2026)

June 16, 2026
Linux find command cheatsheet

The find Command Cheatsheet: Every Recipe You Actually Use (2026)

June 15, 2026
Linux networking commands cheatsheet, ip and ss

Linux Networking Commands in 2026: the ip and ss Cheatsheet

June 15, 2026
  • Online Tools
  • Network Tools
  • Developer Tools
  • Security Tools
Tuesday, June 16, 2026
  • Login
People Are Geek
  • Online Tools
  • Network Tools
  • Developer Tools
  • Security Tools
No Result
View All Result
People Are Geek
No Result
View All Result
Home Developer Tools

SSH Tunnel Command Generator: Local, Remote and Dynamic Forwarding

by People Are Geek
June 14, 2026
in Developer Tools, Network Tools
0
SSH Tunnel Command Generator: Local, Remote and Dynamic Forwarding - cover image
0
SHARES
11
VIEWS
Share on FacebookShare on Twitter

SSH tunnel command generator

Nobody remembers whether they want -L, -R or -D. I’ve looked it up roughly a hundred times. So: pick the direction, drop in your ports and hosts, and you get the one-line ssh command plus a matching ~/.ssh/config block to copy. Every piece gets explained, because the local-versus-remote thing trips up everyone, and honestly it should. It all runs in your browser.

ssh command
$
~/.ssh/config equivalent
Recommended networking gearWe may earn a commission, at no extra cost to you.
Managed Network SwitchCheck price on Amazon →Network Cable TesterCheck price on Amazon →Cat 6 Ethernet CableCheck price on Amazon →Usb To Ethernet AdapterCheck price on Amazon →

What this SSH tunnel generator does

SSH isn’t just a shell. It’ll also shove network ports through its encrypted pipe, which means you can reach stuff that’s private or stuck behind a firewall. There are three forwarding modes: -L, -R and -D. People mix them up constantly. The syntax looks almost identical, but the direction is flipped, and that’s exactly where the confusion lives. This generator just asks what you’re reaching and from where. Then it gives you the right command, plus a ~/.ssh/config entry so you can stop retyping the thing.

Local, remote and dynamic forwarding

ModeWhat it doesExample
-L LocalPulls a remote service onto a local port. You hit localhost, you land on the server side.ssh -L 8080:localhost:80 user@server
-R RemotePushes a local service out to a remote port, so the server (or whoever’s on it) can reach back into your machine.ssh -R 9000:localhost:3000 user@server
-D DynamicSpins up a local SOCKS proxy that shoves any traffic through the SSH server.ssh -D 1080 user@server

Here’s the mnemonic that finally stuck for me. -L brings a remote thing to you, you’re the one listening. -R sends a local thing out, the remote listens instead. And -D just turns the whole SSH server into a proxy you can point traffic at. The -N flag tells SSH to skip the shell, because you only want the tunnel, not a prompt. -f shoves it into the background.

Reading the -L syntax

Take 8080:localhost:80. It means: listen on local port 8080, then forward to localhost:80 as the SSH server sees it. That italicized bit is the whole thing, really. The localhost in there is the server’s localhost, not yours. This is the part that bites people, me included, the first dozen times. Say you’ve got a database only the server can touch. You’d write -L 5432:db.internal:5432, where the server resolves db.internal, and then you point your client at localhost:5432.

Saving tunnels in ssh config

Retyping a long tunnel command is how you end up with a typo at 2am. So the generator also hands you a ~/.ssh/config block, using whichever of LocalForward, RemoteForward or DynamicForward fits. Save it once. After that the tunnel is just ssh mytunnel. The config also tucks away the user, the port, the identity file, the keepalive, all of it in one place, so your commands stay short and everyone on the team is running the same thing.

Privacy and how this tool runs

JavaScript builds the command and the config block right in your browser. The hostnames and key paths you type never leave the page, and nothing gets logged anywhere. Which matters a bit more here than usual, since tunnel configs tend to describe your internal network.

Frequently asked questions

What is the difference between ssh -L and -R?

-L (local) listens on your machine and forwards to something the server can reach, so you get at a remote service through localhost. -R (remote) flips it: the server listens, then forwards back to something your machine can reach, so the server side can poke at one of your local services. The bit I actually memorized: -L pulls in, -R pushes out.

How do I create a SOCKS proxy with SSH?

Dynamic forwarding does it: ssh -D 1080 -N user@server. That gives you a SOCKS5 proxy on local port 1080, and everything you send through it tunnels out via the server. Point your browser or app at socks5://localhost:1080. Handy on sketchy coffee-shop wifi.

Why does my -L tunnel connect to the wrong host?

In -L localport:host:hostport, that host gets resolved by the SSH server, not by you. So if you typed localhost, you just asked for the server itself. Want a different internal box? Put the name or IP the server can see, like -L 5432:db.internal:5432. I’ve lost a couple of hours to exactly this mistake.

What do -N and -f do?

-N says don’t run a remote command, which is what you want for a tunnel, so no shell prompt shows up. -f drops SSH into the background once it’s authenticated. Stick them together and -fN is the old reliable for a background tunnel.

How do I keep an SSH tunnel from dropping?

Add keepalives: -o ServerAliveInterval=60 makes SSH fire a probe every 60 seconds, so it actually notices when the link goes dead. That stops idle drops. It won’t reconnect on its own, though. For that, wrap the tunnel in autossh, or run it as a systemd service with Restart=always.

How do I tunnel through a bastion or jump host?

Reach for -J user@bastion (that’s ProxyJump). One command hops through the bastion to the real host: ssh -J user@bastion -L 8080:localhost:80 user@target. And in your ssh config it’s the same idea, just spelled out as ProxyJump user@bastion.

Sources & further reading

  • man7.org: ssh(1) man page (port forwarding)
  • RFC 4254: SSH Connection Protocol (channels & forwarding)
  • OpenSSH: official manuals

Related tools and resources

A few more builders and references from the same toolkit, if you’re in the mood to keep tinkering.

Common Ports List WireGuard VPN Guide rsync Command Generator chmod Calculator Firewall Rule Helper
ShareTweetPin
People Are Geek

People Are Geek

I'm Stephane, a network and systems engineer with over 15 years of hands-on experience on production infrastructure, virtualization (ESXi, Proxmox), networking, and self-hosting. Earlier in my career I built and ran a Linux resource site that became a well-known reference for sysadmins. Today I focus on cybersecurity, and I also work as a technical trainer, teaching networking and security to people who do it for a living. Everything on People Are Geek comes from real-world practice, not theory. I build every tool on this site myself, and I write about what I've actually deployed, broken, and fixed. If it's here, I've used it.

People Are Geek

Copyright © 2017 JNews.

Navigate Site

  • About PeopleAreGeek
  • Affiliate Disclosure
  • All Tools and Articles
  • Contact
  • Cookie Policy
  • Hyper-V Hub: Tools, Error Fixes and Lab Guides
  • Linux Hub: Cross-Distro Reference, Articles, Tools
  • Privacy Policy
  • Sample Page
  • Terms of Service
  • VMware vSphere & ESXi Hub: Tools, Error Fixes and Guides

Follow Us

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In
No Result
View All Result
  • Online Tools
  • Network Tools
  • Developer Tools
  • Security Tools

Copyright © 2017 JNews.