
Estou em um sistema RHEL 5, conectando-me a outro sistema RHEL 5. Criei um túnel SSH com o seguinte comando:ssh -2 -4 -f -x -N -L 1527:host_remoto:1527 usuário@host_remoto
(remote_host é o mesmo servidor)
Eu digito a senha e retorno imediatamente ao prompt de comando. Eu executo um rápido 'ps axu | grep ssh' para verificar e ver um processo para o comando ssh que acabei de executar:
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
Presumo que meu túnel foi estabelecido com sucesso.
Então eu testei usando 'telnet remote_host 1527', mas não consigo conectar; apenas trava por alguns minutos antes de eu matá-lo. Tento o teste de telnet com diferentes usuários no host local (incluindo o nome de usuário que usei para estabelecer o túnel) e o resultado é o mesmo - sem conexão.
O objetivo deste túnel é conectar-se a um Oracle Listener. Então, eu corro otnspingUtilitário; que também não consegue se conectar. (E sim, tenho a conexão do banco de dados configurada corretamente no arquivo tnsnames.ora.)
O que eu fiz errado?
Responder1
Você não faz telnet para remote_host, você faz telnet para localhost. Se você pudesse telnetar diretamente para remote_host você não precisaria de uma portaavançar.
telnet localhost 1527
Na página de manual do 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.