Native SSH Port Forwarding (Tunneling) on Windows 10

In this text we are going to present the right way to use the to ahead ports by way of an SSH tunnel. SSH port forwarding means that you can tunnel (ahead) app ports from an area pc to a distant server and vice versa. Earlier SSH tunneling was utilized in Linux/Unix atmosphere solely, however at present you should use it in Windows 10/Windows Server 2016 as properly. Here is a case examine of the right way to use an RDP connection by means of the SSH tunnel (TCP port 22) on Windows.

SSH tunneling is generally used within the eventualities when it’s essential connect with a distant pc behind the firewall. For instance, you’ve gotten a Windows Server with solely SSH port open (TCP 22). All different ports are blocked by a firewall or . Your job is to connect with the Windows Server utilizing the RDP shopper. It appears unattainable since is blocked by the firewall. However, you should use the port forwarding approach by means of the SSH tunnel.

Here are the everyday utilization eventualities of SSH tunneling:

  • Local TCP forwarding is an area port forwarding to a distant server;
  • Remote TCP forwarding is a distant port forwarding to an area pc;
  • Double SSH tunnel connects computer systems with none devoted behind NAT by means of an SSH server (if OpenVPN resolution just isn’t relevant).

RDP Access Through SSH Tunnel (Local TCP Forwarding)

In this mode, you create an area TCP port on your pc. All connections to this port are forwarded to the desired port on a distant server by way of the SSH tunnel. In this instance, we are going to create an area Port 8888, and the connection to it is going to be forwarded to the RDP port 3389 on a distant Windows pc. The common connection scheme is proven beneath.

windows 10 ssh tunnel

To create an SSH tunnel utilizing the built-in Windows 10 SSH shopper (is part of Windows ranging from Windows 10 1809 and Windows Server 2019), run this command:

ssh -L 8888: [email protected]

To make the SSH tunnel work within the background, add the –f parameter.

windows 10 connect rsp via ssh tunneling

To connect with a distant pc desktop by way of the SSH tunnel, it’s essential connect with the native Port 8888 of your pc utilizing the RDP shopper (mstsc.exe):

mstsc rdp port forwarding

Login to the distant pc and work safely within the RDP session ( however you keep in mind that port 3389 remains to be closed by the firewall). You can use the TCPView device to guarantee that the RDP connection is native (the RDP connection is initiated by the SSH server operating domestically).


Please word that when you ahead an unencrypted app site visitors, it is going to be transmitted encrypted over the general public networks. Such a site visitors will likely be encrypted on the one finish of your SSH connection and decrypted on the opposite one.

Other computer systems of your native community can even use this mode to connect with an RDP server even when the direct connection just isn’t allowed (each by way of SSH and by way of RDP). To do it, they need to join by way of RDP shopper to port quantity 8888 on your pc with the SSH tunnel created:

mstsc.exe /v

mstsc rdp port forwarding via ssh tunnel on windows 10

Remote TCP Forwarding to a Local Computer

There is one other SSH tunnel use case — distant TCP forwarding. Using the SSH tunnel, you possibly can enable the distant server to entry an area port on your pc or a port on one other pc in your native community. For instance, you need an exterior server ( entry your Intranet web site (not revealed within the Internet). To create a reverse SSH tunnel, use this command:

ssh -R 8080:internalwww:80 [email protected]

To get entry to internalwwww web site from a distant SSH server, it is sufficient to kind this deal with within the browser: http://localhost:8080

Using SSH tunnels, you possibly can construct port forwarding chains. To allow or disable SSH tunneling, add one of many following directives within the OpenSSH config file (%programdatapercentsshsshd_config):

AllowStreamLocalForwarding sure
AllowTcpForwarding distant

Check Also

How to Enable and Configure MPIO on Windows Server 2016/2012R2?

In this text we’ll contemplate how to set up and configure MPIO on Windows Server …

Leave a Reply

Your email address will not be published. Required fields are marked *