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 Listener. Итак, я запускаюtnspingутилита; которая также не может подключиться. (И да, у меня правильно настроено подключение к базе данных в файле tnsnames.ora.)

Что я сделал не так?

решение1

Вы не telnet к remote_host, вы telnet к localhost. Если бы вы могли telnet напрямую к remote_host, вам не нужен был бы портвперед.

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.

Связанный контент