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 database server, let's call it:

dbserver

I have a web server with access to my dbserver, let's call it:

webserver

I have a development machine that I'd like to use to access a database on dbserver, let's call it:

dev

dbserver has a firewall rule set to allow TCP requests from webserver to dbserver:1433

I'd like to set up a tunnel from dev:1433 to dbserver:1433, so all requests to 1433 on dev are passed along to dbserver:1433

My sshd_config on webserver has the following rules set:

AllowTcpForwarding yes
GatewayPorts yes

This is what I've tried (from dev):

ssh -v -L localhost:1433:dbserver:1433 webserver

In another terminal (also from dev):

telnet localhost 1433

Results in:

Trying ::1...
Connected to localhost.
Escape character is '^]'.
Connection closed by foreign host.

Any idea what I'm doing wrong here? Thanks in advance!

share|improve this question
    
Please mark the solution as the answer, for the benefit of future users. –  Zayne S Halsall Apr 27 '10 at 9:33
add comment

2 Answers

ssh -v -L 1433:localhost:1433 webserver
share|improve this answer
    
Found the solution, this was pretty close, but skipped one step. Thanks for your help. –  Patrick Klingemann Apr 26 '10 at 17:31
add comment
up vote 1 down vote accepted

Here was the solution I found:

ssh -v -L 1433:dbserver:1433 webserver -f -N
telnet localhost 1433

Connects me.

share|improve this answer
add comment

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.