SSH tunnel to MSSQL

Step-by-Step descriptions of how to do things.
Post Reply
User avatar
^rooker
Site Admin
Posts: 1483
Joined: Fri Aug 29, 2003 8:39 pm

SSH tunnel to MSSQL

Post by ^rooker »

I had to access an MSSQL database remotely and I wanted to use SSH tunneling for that.

Legend:
[ME] ... The network I am in.
[THEM] ... There's the SQL server.

Here's how I've done it:
1) At [THEM] I've started PuTTY and entered a remote port tunnel to their MSSQL server:

Code: Select all

4L1433 127.0.0.1:1433
...and opened the connection to our [ME] SSH server.

Hint: If accessing a forwarded port doesn't work, check if the ssh-user you're connecting with is allowed to open the requested port(s).

Here's PuTTY's log in such a case:
Event Log: Forwarded connection refused by server: Administratively prohibited [open failed]

2) On my side [ME], I started the "cliconfg" utility: "C:\WINNT\SYSTEM32\CLICONFG.EXE"

- Under "GENERAL", add/enable the protocol "TCP/IP".
- Under "ALIAS" add a new alias "FARSIDE" with server name "x.x.x.x", Protocol "TCP/IP".
(where "x.x.x.x" is the IP of my local SSH server)


3) In order to connect to the remote database, use "FARSIDE" as servername. The system resolves this to the SSH server's IP.
Jumping out of an airplane is not a basic instinct. Neither is breathing underwater. But put the two together and you're traveling through space!
Post Reply