Tutorial
How to create your first SSH tunnel on Windows
An SSH tunnel makes a port on your Windows PC lead to a service that only your SSH server can reach. Windows 11 already includes everything you need: one ssh command in PowerShell is enough.
- Level
- Beginner
- Reading time
- 8 min
- Applies to
- Windows, OpenSSH command line
- Transputty steps checked against
- Transputty 0.1 (development build, not released)
Before you start
- A Windows 11 PC and an SSH login you already have. The section "What you need" below lists the details.
Short answer
To create an SSH tunnel on Windows, open PowerShell and run ssh -N -L 8080:localhost:80 deploy@bastion.example.com. Log in, leave the window open, and browse to http://localhost:8080. Port 8080 on your PC now leads to port 80 on the SSH server. Press Ctrl+C to stop it.
Transputty, the third method below, is in development. Version 0.1 is an internal build and there is no public download yet; see the release status page. The first two methods work today with software you already have or can get freely.
What you need
- A Windows 11 PC. The OpenSSH client is included.
- An SSH server you can log in to. This tutorial uses
deploy@bastion.example.com. A bastion (also called a jump host) is the one server you are allowed to SSH into, which can in turn reach the private machines behind it. Ifssh deploy@bastion.example.comgives you a shell, you are ready. - The address of the thing you want to reach, from the server's point of view. A web admin page that runs on the server itself is
localhost:80. A database on the server's private network might bedb.internal:5432. - A free port on your PC. Any number from 1024 to 49151 that nothing else uses. This tutorial uses 8080.
If a colleague told you to "use a tunnel", these are the values to ask them for. The server must also permit forwarding. OpenSSH servers do by default (AllowTcpForwarding yes).
The 60-second concept
A local tunnel has three parts:
your app -> 127.0.0.1:8080 on your PC ==SSH==> bastion.example.com -> localhost:80
(the listening port) (the SSH server) (the destination)
SSH listens on a port on your PC, which means it waits there for programs to connect. 127.0.0.1, also written localhost, is the loopback address: only programs on the same computer can reach it. Whatever connects to that port is carried inside the encrypted SSH connection, and the SSH server opens the final connection to the destination. Your app talks to localhost:8080 and never knows the difference. The local port forwarding guide explains the mechanics; you do not need it to finish this tutorial.
Pick one method. Method 1 needs nothing installed and is the one to use if you are unsure. Method 2 is for people who already use PuTTY. Method 3 describes Transputty, which cannot be downloaded yet.
Method 1: the built-in OpenSSH client
Open Terminal or PowerShell from the Start menu and check that the client is there:
ssh -V
It prints a version such as OpenSSH_for_Windows_9.5p2. If PowerShell answers that ssh is not recognized, the client has been removed from this PC: open Settings › System › Optional features, add OpenSSH Client, and open a new PowerShell window. Now start the tunnel:
ssh -N -L 8080:localhost:80 deploy@bastion.example.com
-L 8080:localhost:80 means "listen on port 8080 here; send connections to localhost:80 as seen from the server". -N means "do not start a remote shell". Then:
- The first time you connect, ssh shows the server's key fingerprint and asks
Are you sure you want to continue connecting (yes/no/[fingerprint])?. Compare the fingerprint with one from your server administrator, then typeyes. - Enter your password, or your key's passphrase, and press Enter. Nothing appears on screen while you type, not even dots. That is normal.
- Nothing else is printed. The window now looks idle: that is the tunnel running. Leave it open.
Check that it works
Open a second PowerShell window:
Test-NetConnection 127.0.0.1 -Port 8080
TcpTestSucceeded : True means something is listening on the port. It does not prove the far end works, so make a real request as well. Use curl.exe with the extension, because plain curl in Windows PowerShell is an alias for a different command:
curl.exe -I http://localhost:8080/
You should see the HTTP headers of the page on the server. In a browser, open http://localhost:8080.
Method 2: PuTTY
PuTTY keeps tunnels in its session settings. The labels below are from the PuTTY manual for current releases.
- Start PuTTY. On the Session panel, type
bastion.example.comin Host Name (or IP address) and leave Port at 22. - In the category tree, open Connection › SSH › Tunnels.
- Under Add new forwarded port, type
8080in Source port andlocalhost:80in Destination. Leave Local selected. - Click Add. The Forwarded ports list now shows
L8080 localhost:80. If you skip Add, the tunnel is silently not created; this is the most common PuTTY mistake. - Optional: on Connection › SSH, tick Don't start a shell or command at all for a tunnel-only session (the same as
-N). - Go back to Session, type a name such as
bastion web tunnelunder Saved Sessions and click Save. Otherwise the tunnel settings are gone next time. - Click Open, accept the host key if it is correct, and log in. The tunnel lasts while the PuTTY window is open.
PuTTY uses its own .ppk key format. If you log in with keys, see how to use SSH private keys for converting between formats.
Method 3: Transputty (in development, not yet downloadable)
Transputty is an SSH tunnel manager: it saves the server and its forwards as a connection, shows whether each forwarding rule is healthy, and reconnects when the link drops. You cannot install it yet. These are the steps in the 0.1 development build.
- Click + in the toolbar or press Ctrl+N. The New connection dialog opens as one scrolling form with the PostgreSQL preset selected.
- Under Start from a preset, click Web. That replaces the PostgreSQL rule with one rule named
webfrom127.0.0.1:8443tolocalhost:443, the same shape as this tutorial's tunnel. - Under Forwarding rules, change the two port numbers to match method 1: the Port next to Listen address to
8080, and the destination Port to80. Leave everything else in the rule as it is. - Under SSH server, fill in Host (
bastion.example.com, withoutuser@), Port (22) and User (deploy). - Under Authentication, choose Password for a first tunnel with a password. There is no password box here; Transputty asks when it connects.
- Click Save & connect. If a field is wrong, the first problem is shown next to the buttons, which stay disabled until it is fixed.
- A dialog headed "First connection to this server" shows the SHA256 fingerprint. Compare it with one from your server administrator, then click Trust and connect (saves the key) or Connect once.
- The prompt "Password for deploy@bastion.example.com" appears. Type the password and click Connect.
The row shows the pill "Connected" and the rule shows "Active". Select the row and press Ctrl+C to copy 127.0.0.1:8080, then check it the same way as in method 1.
Next: reach a database instead
The same command reaches a database. Swap the two port numbers and the destination:
ssh -N -L 5433:db.internal:5432 deploy@bastion.example.com
Then give your database client host 127.0.0.1 and port 5433. The local port is 5433, not 5432, so that it cannot collide with a PostgreSQL installed on your own PC. Full walk-throughs: PostgreSQL, MySQL and SQL Server.
How do I stop the tunnel?
- OpenSSH: press Ctrl+C in the window running ssh, or close that window. The port stops listening immediately;
Test-NetConnection 127.0.0.1 -Port 8080then reportsFalse. - PuTTY: close the PuTTY window and confirm.
- Transputty: select the connection and click Disconnect in the toolbar, click the round Beacon on its row, or press Space. Closing the window does not stop tunnels by default; they keep running in the notification area.
What to do when it fails
| What you see | Likely cause | Next step |
|---|---|---|
ssh : The term 'ssh' is not recognized |
The OpenSSH client feature is not installed | Settings › System › Optional features, add OpenSSH Client, then open a new PowerShell window |
ssh: connect to host ... port 22: Connection timed out |
The SSH server is unreachable from your network | Check the host name, VPN and firewall. This is not a tunnel problem yet |
Permission denied (publickey,password) |
Wrong user, password or key | Log in without -L first: ssh deploy@bastion.example.com |
ssh starts, but the browser shows "connection refused" or an empty reply, and the ssh window prints channel 2: open failed: connect failed |
The server could not reach the destination | See SSH tunnel "connection refused" |
| The port is already taken, or your app reaches some other program on 8080 | Another program uses the local port | See local port already in use, or pick another port such as 8081 |
| It works, then stops after a while | Idle timeout, sleep or a network change | See SSH tunnel keeps disconnecting |
Plain ssh is enough for one tunnel you use now and then. When you have several, or need them to survive a dropped connection, continue with managing multiple SSH tunnels on Windows.
Common questions
Does Windows have a built-in SSH client for tunnels?
Yes. Windows 11 includes the OpenSSH client, so ssh works in PowerShell, Windows Terminal and Command Prompt without installing anything. Run ssh -V to see the version. A tunnel is one command, for example ssh -N -L 8080:localhost:80 deploy@bastion.example.com, and it lasts as long as that window stays open.
Why does the ssh window just sit there after I start a tunnel?
That is the tunnel running. The -N option tells ssh not to start a remote shell, so after you log in it prints nothing and waits. The tunnel works for as long as the command runs. Press Ctrl+C in that window, or close it, to stop the tunnel.
Is traffic through an SSH tunnel encrypted?
Traffic is encrypted between your PC and the SSH server. The last step, from the SSH server to the destination service, is an ordinary connection and is only as protected as that service's own protocol. If the destination is the SSH server itself (localhost), nothing leaves the server unencrypted.
What does localhost mean in ssh -L 8080:localhost:80?
The destination in a local forward is resolved by the SSH server, not by your PC. So localhost:80 means port 80 on the SSH server itself. To reach another machine on the server's network, write its name instead, for example ssh -L 5433:db.internal:5432.
Can I download Transputty to manage the tunnel?
Not yet. Transputty is an SSH tunnel manager for Windows 11 that is still in development, and there is no public build. The built-in ssh command and PuTTY, both covered in this tutorial, create the same tunnel today.
How this tutorial was checked
2026-11-26: The OpenSSH steps (method 1) were run on Windows 11 with the built-in client, OpenSSH_for_Windows 9.5p2, and checked with curl.exe, Test-NetConnection and netstat, including after stopping ssh. The server was the Transputty project's own test SSH server on the same PC, not a real OpenSSH sshd. The PuTTY steps (method 2) were written from the PuTTY manual; PuTTY was not run. The Transputty steps (method 3) were written from the 0.1 source code and its on-screen text; they were not clicked through in the running app.
Sources and further reading
Transputty keeps SSH tunnels running on Windows
Local, remote and SOCKS5 forwards in one window, automatic reconnection with ports that stay bound, and a clear reason when something fails. In development; no public build yet.