1

Almost all of the google result for my problem has different case about tunneling connection to my oracle server, they usually has ssh server/client within the oracle server

but i have another case with followed illustration:

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)

my php program should has access to oracle server and i do in my ssh client:

ssh -p 212 user@192.168.137.2 -R 1521:128.21.31.112:1521

from what i read, this tunneling should do:

every connection => (in)192.168.137.2:1521 on ssh server => (out) 128.21.31.112:1521 on ssh client

then i try :

[user@192.168.137.2]$ sqlplus64 user/passwd@//192.168.137.2:1521/sid

but unfortunely i got:

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:

any one can give me any solution and how to debug this?

additional info :
when the web server connect to oracle server directly, everything just fine ..
i cannot do anything on the oracle server

i try this on myssh client :

ssh -vvv -p 212 user@192.168.137.2 -R 1521:128.21.31.112:1521

got :

debug2: channel 0: send open
debug1: Requesting no-more-sessions@openssh.com
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
kreamik
  • 131
  • 1
  • 4
  • How could you try to create ssh tunnel if on the 128.21.31.112 no ssh at all? – ALex_hha Jul 24 '13 at 08:04
  • i think tunneling will be end to ssh client, then the ssh client will contact the oracle server on port 1521 like i do before on web server when connect directly to oracle server that no need ssh service. – kreamik Jul 24 '13 at 08:40

2 Answers2

1

This absolutely is possible. If you are running the ssh client from your web server:

ssh -L 1521:128.21.31.112:1521 user@192.168.137.2 -N

And then connect on localhost:1521, where localhost is the web server.

If you want the tunnel to bind specifically to 192.168.137.2 then

ssh -L 192.168.137.2:1521:128.21.31.112:1521 user@192.168.137.2 -N
GeoSword
  • 1,657
  • 12
  • 16
0

You could try do the trick with iptables on the 192.168.137.1/192.168.137.2

# iptables -t nat -I OUTPUT -p tcp --dport 1251 -j DNAT --to-destination 128.21.31.112:1521

After that try something like

# sqlplus64 user/passwd@localhost:1251/sid
ALex_hha
  • 7,193
  • 1
  • 25
  • 40