Sign up ×
Server Fault is a question and answer site for 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, behind a masquerading gateway. No port forwarding to is possible.

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

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 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

Is this scenario possible?


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' connect=

Didn't test it, but that's what it should look like. has lots of examples. I like this site the most.


Looking at your image - what I wrote here is supposed to work on the machine you called Gateway. Calling a.b.c.d from 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


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.