Why can't I connect to remote Microsoft SQL Server through SSH tunnel?
Posted
by
Alexander
on Server Fault
See other posts from Server Fault
or by Alexander
Published on 2011-02-10T12:37:37Z
Indexed on
2012/04/09
23:35 UTC
Read the original article
Hit count: 285
sql-server
|ssh-tunnel
I have at home a D-Link DIR-615 C1 router with DD-WRT. I set up the SSH server on the router, and log on through an SSH2-RSA passphrase-protected key. That router is the gateway between the local network and the internet. One of the computers on that network has Microsoft SQL Server 2008 installed, with TCP/IP protocol enabled through port 1433. I've set up port forwarding on the router, so that remote connections are possible and are, in fact, working (some developers log on remotely without problems).
I am part of another network, that has internet access through a proxy server, which only has ports 80 and 443 opened. I can't connect to that MSSQL server on that remote server because 1433 port is closed on this network.
I connected (using Putty) through 443 port to my router's SSH server, and set up 2 tunnels. One is for RDP (3389), and it's working. The other is for 1433 port, to connect to the server.
I can't connect through the SSH tunnel to the MS SQL Server, neither through telnet, or through GUI clients.
Am I missing something?
Additional details:
on connect, I get this error from SQL Server Management Studio:
TITLE: Connect to Server
Cannot connect to localhost:14330.
ADDITIONAL INFORMATION:
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) (Microsoft SQL Server, Error: 3)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=3&LinkId=20476
BUTTONS:
OK
The tunnel is configured like this:
L14330 192.168.0.103:1433
192.168.0.103
is the permanent address of the SQL Server on the LAN. I also successfully forwarded TCP traffic of 3389
port to that IP, so tunneling is working to that IP address.
When connecting without tunnel, through Microsoft SQL Server Management Studio, using the same method the connection establishes. Too bad my proxy doesn't allow 1433 port traffic, I wouldn't have this headache.
© Server Fault or respective owner