Windows host tunnel through a middle linux server to another linux host with limited ports

0

Addendum:

I've seen question "Windows HTTP tunnel through 2 Linux hosts?" and trying to learn something about the answers. I learned. I will start giving my problem, and then talking a little about my tests with answers of that question.

I'm trying to connect my windows host to a linux host, using a middle linux (the only one with external IP).

What's my problem:

My windows host doesn't have the ports I want open (game and traffic ports).

I have a linux host that have the ports I want open.

So, the problem would be solved if I could make a ssh tunnel through my windows hostto my linux host. The problem is that both of then only have an internal IP (one is on my company, another is on my university).

The salvation: I have acces to my company's linux server, that has an external IP (200.X.X.X).

So, I'd like to use this linux server as an intermediate though my windows host and my linux host.

The complicating: 

My linux server only has the port 110 open. I can only connect through ssh to it using the 110 port.

In other words: I'm needing an example such that I can make:

windows host's firefox, proxified to use localhost:9999

redirects its access to linux server,

that redirects its access to my linux host.

One (but not the only one) idea is reverse tunneling my linux host to my linux server, and then direct tunneling my windows host to my linux server, making this linux server redirect my windows host access to my linux host.

But I do not know the commands to try that.

I tried, but with no success:

linux host: ssh -R 20000:localhost:22 middle_user@200.X.X.X -p110

windows host: ssh -L 9999:localhost:20000 middle_user@200.X.X.X -p110

How can I do that?

My environment, in another words:


Windows host (internal IP == 10.X.X.X ; all ports open)

going through

Linux Server (external IP == 200.X.X.X ; can only connect using ssh to it on port 110, the port 110 is the only open)

redirecting windows host traffic to

Linux Host (internal IP == 192.X.X.X ; ports open, can connect using ssh on port 22)


Another addendum:

This would work if, on my linux server, I could (in a perfect world) access my linux host (what is impossible, given that I have an internal IP on my linux host)

windows host: ssh -L 9999:localhost:9999 -D 9999 -p 110 middle_user@200.X.X.X

linux server: ssh -D 9999 linux_host_user@linux_host_ip

Gabriel L. Oliveira

Posted 2011-04-27T02:41:07.240

Reputation: 774

Answers

0

Adapted from answer How to ssh to an unreachable remote machine by tunneling through a server that everyone can reach?

The "solution" that worked is:

  • on linux-user, I did ssh -R 1234:localhost:22 server_user@200.X.X.X -p110

  • on windows-user, I did ssh -L 1235:localhost:1234 server_user@200.X.X.X -p110

then,

  • on windows-user, I did ssh -D 9999 -p 1235 linux-user@localhost

and then, on windows-user, I could configure firefox to use proxy socks localhost:9999, and could access a server running on my linux-user machine.

P.S.: For ssh on windows, I used cygwin to install openssh, to facilitate things.

Gabriel L. Oliveira

Posted 2011-04-27T02:41:07.240

Reputation: 774