
Estoy en un sistema RHEL 5 y me conecto a otro sistema RHEL 5. Creé un túnel SSH con el siguiente comando:ssh -2 -4 -f -x -N -L 1527:host_remoto:1527 usuario@host_remoto
(remote_host es el mismo servidor)
Escribo la contraseña e inmediatamente vuelvo al símbolo del sistema. Ejecuto un rápido 'ps axu | grep ssh' para verificar y ver un proceso para el comando ssh que acabo de ejecutar:
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
Supongo que mi túnel se estableció correctamente.
Luego pruebo usando 'telnet remote_host 1527' pero no se puede conectar; simplemente se cuelga durante varios minutos antes de que lo mate. Intento la prueba de telnet con diferentes usuarios en el host local (incluido el nombre de usuario que utilicé para establecer el túnel) y el resultado es el mismo: no hay conexión.
El propósito de este túnel es conectarse a un Oracle Listener. Entonces, ejecuto eltnspingutilidad; eso tampoco logra conectarse. (Y sí, tengo la conexión de la base de datos configurada correctamente en el archivo tnsnames.ora).
¿Qué hice mal?
Respuesta1
No haces telnet a host_remoto, sino a localhost. Si pudieras hacer telnet directamente a remote_host no necesitarías un puertoadelante.
telnet localhost 1527
Desde la página de manual de 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.