SSH port forwarding through Windows machine

by Leonardo Ramé   Last Updated August 13, 2019 20:00 PM - source

is it possible to connect to an SSH server only accessible from inside a network, using a Windows machine without SSH as a gateway?.

Let me clarify my question with a sketch:

Me (Linux machine)---> WIN (Windows without SSHD)--->LIN (Linux with SSHD).

Machine Me, is the PC I'm using to connect to LIN through WIN. WIN is accessible from the outside, it has an RDESKTOP port open, and LIN is only accessible from inside the network.

Hope you understand the question.

Answers 4

No, sshd does the forwarding so without a SSH daemon running in Windows you cannot.

March 28, 2012 23:10 PM

OpenSSH has a very flexible ability to use proxy via the ProxyCommand option. If the Windows box doesn't have an SSH daemon on it, then can you install a socks proxy, an HTTP CONNECT proxy, or a generic TCP proxy? If so, then you can use it as a point to connect to the internal system. The exact details would depend on exactly what kind of proxy you install, and what kind of firewalls/filters are between the various systems.

There is no way you are going to do this without installing at least some kind of proxy on the Windows box. Windows doesn't have any built-in generic proxy that would allow it to forward SSH traffic.

March 28, 2012 23:10 PM

The core question is if you can connect to some service through another machine. The answer is yes, but you need software.

I just did a quick google and found this thing: The same exists on Linux in various utilities, but my personal favorite is rinetd

Both work the same way - you run a program that basically forwards packets from one host to another. If you have access to the machine in the middle, you should be able to install a daemon / server that will do this.

March 28, 2012 23:17 PM

Windows has the builtin port mapping mechanism:

netsh interface ipv6 install  # Port forwarding needs to enable ipv6
netsh interface portproxy add v4tov4 listenaddress= listenport=22 connectaddress= connectport=22

Replace with your Windows Server's public IP, and replace with your Linux Server's intranet IP

August 13, 2019 18:03 PM

Related Questions

How to troubleshoot GRE tunnel issues?

Updated November 14, 2018 14:00 PM

SSH tunneling between networks without port forwarding

Updated February 21, 2019 17:00 PM

SSH Tunnel connect 2 Servers via thrid Server

Updated May 20, 2017 18:00 PM

Persistent ssh tunnel in windows

Updated March 04, 2018 20:00 PM