Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a machine running MySQL (Windows), on a private network (let's say 192.168.1.10), behind a masquerading gateway. No port forwarding to 192.168.1.10 is possible.

I also have a server with a public ip (a.b.c.d) which I need to connect to 192.168.1.10:3306.

I can easily achieve this by using ssh's remote port forward feature; however, I was wondering if it's possible to achieve the same thing using stunnel. I need 192.168.1.10 to connect to a.b.c.d and tell a.b.c.d to open a port which will be forwarded back through stunnel to 192.168.1.10:3306.

Is this scenario possible?

image.

share|improve this question

1 Answer 1

Install stunnel on the server that is supposed to do the forvarding and include this in your config when you get it running:

[mysql] accept=gateway's.public.ip.here:3306 connect=192.168.1.10:3306

Didn't test it, but that's what it should look like.

Stunnel.org has lots of examples. I like this site the most.

EDIT:

Looking at your image - what I wrote here is supposed to work on the machine you called Gateway. Calling a.b.c.d from 192.168.1.10 should be possible without anything done.

You can also configure Gateway to be a proxy.

Regardless what You use - everything will require you to work with the Gateway.

share|improve this answer
    
Thanks for the link. Somehow I don't think your ideea will work; check out the image I added, I hope it'll make things more clear. I'm gonna start digging through Stunnel's FAQ. I was trying to avoid that since I have zero experience with it and little time. –  Unknown Nov 10 '10 at 15:38
    
Yes I know, but I don't have any control over the Gateway machine, unfortunately :( ssh can do exactly this thing I described. (-R option) –  Unknown Nov 11 '10 at 7:37
    
so maybe use [on linux] screen to start an ssh -D (or even monit) and keep it going. If oyu don't know how - post another question [ssh -D as a service] and link to it in here. –  naugtur Nov 12 '10 at 8:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.