如何通过ssh隧道链(双隧道,公司网络中的服务器)连接到Oracle数据库11g服务器? [英] How can I connect to Oracle Database 11g server through ssh tunnel chain (double tunnel, server in company network)?
问题描述
我有SSH访问公共服务器,这也是到公司网络的网关。网络中有另一个服务器,其中本地 Oracle数据库服务器正在运行(无法从此服务器外部访问,只接受localhost数据库连接)。当然,我还有另一个SSH访问这个服务器。
有没有办法从网络外部加入这个Oracle数据库11g服务器?
我问如果有什么像ssh隧道链,我如何配置它。
这可以是有用的,例如,对于TOAD for Oracle(ORACLE客户端)。
EDIT: p>
感谢
是的,这是可能的。例如。在Linux上,运行
ssh -N -Llocalport:dbserver:dbport yourname @ connectionserver
其中
- localport是您机器上的端口
- dbserver是数据库服务器的名称或IP
- dbport
- connectionserver是您拥有ssh访问权限的计算机 li>
在Windows上使用Plink(与Putty一起使用)可以做到这一点:
plink -N -L localport:dbserver:dbport yourname @ connectionserver
在两台计算机(您的本地计算机和您有权访问的服务器)上执行此操作以链接ssh隧道。示例:
连接服务器(假设Linux):
ssh - N -L1521:dbserver:1521 dblogin @ dbserver
您的电脑:
plink -N -L 1521:connectionserver:1521 connlogin @connectionerver
tnsnames.ora条目必须看起来像运行一个本地数据库,例如
prodoverssh =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS =(PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = prod)
)
)
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.
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).
EDIT: Here is image
Thanks
Yes, it's possible. E.g. on Linux, run
ssh -N -Llocalport:dbserver:dbport yourname@connectionserver
where
- localport is the port on your machine which will be forwarded (can be 1521 if there is no local instance of oracle running)
- dbserver is the name or IP of the database server
- dbport is the port of the database (usually 1521)
- yourname is the login on the connectionserver
- connectionserver is the machine where you have ssh access
The same can be done on Windows using Plink (which comes with Putty):
plink -N -L localport:dbserver:dbport yourname@connectionserver
Do this on both machines (your local machine and the server you have access to) to chain the ssh tunnels. Example:
Connection server (assuming Linux):
ssh -N -L1521:dbserver:1521 dblogin@dbserver
Your PC:
plink -N -L 1521:connectionserver:1521 connlogin@connectionserver
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数据库11g服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!