几乎所有的谷歌结果为我的问题有不同的情况下隧道连接到我的oracle服务器,他们通常有oracle服务器内的SSH服务器/客户端
但我有另一个案例跟随插图:
Web Server(port80) and SSH Server(port 212) and Oracle client with sqlplus (192.168.137.2) || || SSH client (192.168.137.1/128.21.31.111) -> i do ssh tunneling here || || Oracle Server (port 1521) (128.21.31.112)
我的PHP程序应该有权访问Oracle服务器,我做我的SSH客户端:
ssh -p 212 [email protected] -R 1521:128.21.31.112:1521
从我读到的,这个隧道应该这样做:
every connection => (in)192.168.137.2:1521 on ssh server => (out) 128.21.31.112:1521 on ssh client
然后我尝试:
[[email protected]]$ sqlplus64 user/passwd@//192.168.137.2:1521/sid
但不幸的是我得到了:
SQL*Plus: Release 11.2.0.3.0 Production on Wed Jul 24 09:30:17 2013 Copyright (c) 1982, 2011, Oracle. All rights reserved. ERROR: ORA-12541: TNS:no listener Enter user-name:
任何人都可以给我任何解决scheme,以及如何debugging?
附加信息 :
当Web服务器直接连接到oracle服务器时,一切都很好..
我无法在oracle服务器上做任何事情
我在myssh客户端上试试这个:
ssh -vvv -p 212 [email protected] -R 1521:128.21.31.112:1521
得到 :
debug2: channel 0: send open debug1: Requesting [email protected] debug1: Entering interactive session. debug1: remote forward success for: listen 1521, connect 128.21.31.112:1521 debug1: All remote forwarding requests processed debug2: callback start debug2: fd 3 setting TCP_NODELAY debug3: packet_set_tos: set IP_TOS 0x10 debug2: client_session2_setup: id 0 debug2: channel 0: request pty-req confirm 1 debug2: channel 0: request shell confirm 1 debug2: callback done debug2: channel 0: open confirm rwindow 0 rmax 32768 debug2: channel_input_status_confirm: type 99 id 0 debug2: PTY allocation request accepted on channel 0 debug2: channel 0: rcvd adjust 2097152 debug2: channel_input_status_confirm: type 99 id 0 debug2: shell request accepted on channel 0 Last login: Thu Jul 25 07:04:56 201
这绝对是可能的。 如果您正在从您的Web服务器运行ssh客户端:
ssh -L 1521:128.21.31.112:1521 [email protected] -N
然后在localhost:1521上连接,其中localhost是Web服务器。
如果你想隧道专门绑定到192.168.137.2然后
ssh -L 192.168.137.2:1521:128.21.31.112:1521 [email protected] -N
你可以尝试在192.168.137.1/192.168.137.2上使用iptables
# iptables -t nat -I OUTPUT -p tcp --dport 1251 -j DNAT --to-destination 128.21.31.112:1521
之后,尝试类似的东西
# sqlplus64 user/passwd@localhost:1251/sid