Forwarding ports with ssh on Linux

Posted by Patrick Klingemann on Server Fault See other posts from Server Fault or by Patrick Klingemann
Published on 2010-04-26T17:01:36Z Indexed on 2010/04/26 17:04 UTC
Read the original article Hit count: 277

Filed under:
|
|
|
|

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:

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

In another terminal:

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!

© Server Fault or respective owner

Related posts about ssh

Related posts about ssh-tunnel