SSHトンネルは正常に作成されましたが、Telnetテストはまだ失敗します

SSHトンネルは正常に作成されましたが、Telnetテストはまだ失敗します

私は RHEL 5 システムを使用しており、別の RHEL 5 システムに接続しています。次のコマンドで SSH トンネルを作成しました。ssh -2 -4 -f -x -N -L 1527:リモートホスト:1527 ユーザー@リモートホスト

(remote_hostは同じサーバーです)

パスワードを入力すると、すぐにコマンド プロンプトに戻ります。「ps axu | grep ssh」をすばやく実行して、実行した ssh コマンドのプロセスを確認します。

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

トンネルは正常に確立されたと思います。

次に、「telnet remote_host 1527」を使用してテストしましたが、接続に失敗し、数分間ハングしてから終了しました。ローカル ホスト上の別のユーザー (トンネルを確立するために使用したユーザー名を含む) を使用して telnet テストを試行しましたが、結果は同じで、接続されません。

このトンネルの目的はOracleリスナーに接続することです。tnspingユーティリティ; これも接続に失敗します。(はい、tnsnames.ora ファイルでデータベース接続が正しく構成されています。)

何を間違えたのでしょうか?

答え1

remote_hostにtelnetするのではなく、localhostにtelnetします。remote_hostに直接telnetできる場合はポートは必要ありません。フォワード

telnet localhost 1527

ssh のマニュアルページから:

 -L [bind_address:]port:host:hostport
         Specifies that the given port on the local (client) host is to be
         forwarded to the given host and port on the remote side.  This
         works by allocating a socket to listen to port on the local side,
         optionally bound to the specified bind_address.  Whenever a con-
         nection is made to this port, the connection is forwarded over
         the secure channel, and a connection is made to host port
         hostport from the remote machine.  Port forwardings can also be
         specified in the configuration file.  IPv6 addresses can be spec-
         ified with an alternative syntax:
         [bind_address/]port/host/hostport or by enclosing the address in
         square brackets.  Only the superuser can forward privileged
         ports.  By default, the local port is bound in accordance with
         the GatewayPorts setting.  However, an explicit bind_address may
         be used to bind the connection to a specific address.  The
         bind_address of “localhost” indicates that the listening port be
         bound for local use only, while an empty address or ‘*’ indicates
         that the port should be available from all interfaces.

関連情報