通过 SSH 隧道访问 SQL Server [英] Accessing SQL Server over an SSH tunnel

查看:60
本文介绍了通过 SSH 隧道访问 SQL Server的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的开发车间,我们在位于远程网络的虚拟服务器上部署代码.

In my development shop, we deploy code on virtual servers that sit on a remote network.

我们首先打开到网关服务器的 SSH 连接,然后通过本地端口通过 SSH 隧道传输 RDP,从而访问该网络上的机器.

We access the machines on that network by first opening an SSH connection to a gateway server, and then SSH-tunneling RDP over a local port.

我非常希望能够以相同的方式在本地访问在这些服务器上运行的 SQL Server 实例.

I would very much like to be able to locally access SQL Server instances running on these servers in the same way.

我已经设置了一个本地端口 (3398) 以重定向到远程实例上的 SQL Server 端口 (L3398 -> remote.machine.com:1433).

I've set up a local port (3398) to redirect to the SQL Server port on the remote instance (L3398 -> remote.machine.com:1433).

然后我可以通过 telnet 到 localhost 3398 来实际测试连接,并且我得到一个连接:屏幕清除,我可以输入字符到一些监听进程.

I can then actually test the connection by telnetting to localhost 3398, and I get a connection: the screen clears and I can type characters to some listening process.

但是当我尝试将 SSMS 连接到 localhost:3398 时,它超时,然后声称没有 SQL Server 侦听该端口:

But when I try to connect SSMS to localhost:3398, it times out and then claims that there is no SQL Server listening on that port:

Cannot connect to localhost:3398

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. (...)

我确信服务器接受远程连接,因为我在通过 RDP 登录到远程网络中的另一台机器时远程连接到它.

I am sure that the server accepts remote connections, because I have connected to it remotely while logged in via RDP to a different machine within the remote network.

我通过谷歌搜索知道这是可能的;有没有人知道为什么这不起作用,或者我可以做什么来诊断并希望解决问题?

I have Googled around to know that this is possible; does anyone have some idea why this isn't working, or what I might do to diagnose and hopefully fix the problem?

谢谢!

推荐答案

而不是连接到 localhost:3398使用 127.0.0.1,3398

Instead of connecting to localhost:3398 Use 127.0.0.1,3398

这篇关于通过 SSH 隧道访问 SQL Server的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆