如何通过 ssh 隧道链(双隧道,公司网络中的服务器)连接到 Oracle Database 11g 服务器? [英] How can I connect to Oracle Database 11g server through ssh tunnel chain (double tunnel, server in company network)?

查看:52
本文介绍了如何通过 ssh 隧道链(双隧道,公司网络中的服务器)连接到 Oracle Database 11g 服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以通过 SSH 访问公共"服务器,这也是通往公司网络的网关.网络中有另一台服务器,本地 Oracle 数据库服务器正在运行(没有来自该服务器外部的访问,只接受本地主机数据库连接).当然,我还有另一个 SSH 访问此服务器的权限.

I have SSH access to 'public' server, which is also the gateway to company network. There is another server in the network, where local Oracle Database server is running (There is no access from outside of this server, only localhost DB connections are accepted). And of course, I have another SSH access to this server.

有没有办法从网络外部加入这个 Oracle Database 11g 服务器?我在问是否有类似 ssh 隧道链的东西,以及我如何配置它.例如,这对于 TOAD for Oracle(ORACLE 客户端)很有用.

Is there any way to join to this Oracle Database 11g Server from outside of the network ? I am asking if there is something like ssh tunnel chain, and how i configure it. This can be usefull, for example, for TOAD for Oracle (ORACLE client).

这是图片

谢谢

推荐答案

是的,这是可能的.例如.在 Linux 上,运行

Yes, it's possible. E.g. on Linux, run

ssh -N -Llocalport:dbserver:dbport yourname@connectionserver

哪里

  • localport 是你机器上将被转发的端口(如果没有运行oracle的本地实例,可以是1521)
  • dbserver 是数据库服务器的名称或 IP
  • dbport 是数据库的端口(通常是 1521)
  • 你的名字是连接服务器上的登录名
  • connectionserver 是您具有 ssh 访问权限的机器

同样可以在 Windows 上使用 Plink(Putty 附带)来完成:

The same can be done on Windows using Plink (which comes with Putty):

plink -N -L localport:dbserver:dbport yourname@connectionserver

在两台机器(您的本地机器和您有权访问的服务器)上执行此操作以链接 ssh 隧道.示例:

Do this on both machines (your local machine and the server you have access to) to chain the ssh tunnels. Example:

连接服务器(假设为 Linux):

Connection server (assuming Linux):

ssh -N -L1521:dbserver:1521 dblogin@dbserver

您的电脑:

plink -N -L 1521:connectionserver:1521 connlogin@connectionserver

tnsnames.ora 条目必须看起来像您正在运行本地数据库,例如

The tnsnames.ora entry must look like you are running a local database, e.g.

prodoverssh =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = prod)
    )
  )

这篇关于如何通过 ssh 隧道链(双隧道,公司网络中的服务器)连接到 Oracle Database 11g 服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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