I am on a RHEL 5 system, connecting to another RHEL 5 system. I created a SSH tunnel with the following command: ssh -2 -4 -f -x -N -L 1527:remote_host:1527 user@remote_host
(remote_host is the same server)
I type the password, and I'm immediately returned to the command prompt. I run a quick 'ps axu | grep ssh' to verify and see a process for the ssh command I just executed:
dashbrd 17861 0.0 0.1 68796 13224 ? Ss 12:44 0:00 ssh -2 -4 -f -x -N -L 1527:remote_host:1527 user@remote_host
I assume my tunnel is established successfully.
Then I test using 'telnet remote_host 1527' but that fails to connect; just hangs for several minutes before I kill it. I try the telnet test with different users on the local host (including the username I used to establish the tunnel) and the result is the same – no connection.
The purpose of this tunnel is to connect to an Oracle Listener. So, I run the tnsping utility; that also fails to connect. (And yes, I have the database connect configured correctly in the tnsnames.ora file.)
What did I do wrong?
Best Answer
You don't telnet to remote_host, you telnet to localhost. If you could telnet directly to remote_host you wouldn't need a port forward.
From the ssh man page: