
Ich bin auf einem RHEL 5-System und verbinde mich mit einem anderen RHEL 5-System. Ich habe mit dem folgenden Befehl einen SSH-Tunnel erstellt:ssh -2 -4 -f -x -N -L 1527:remote_host:1527 Benutzer@remote_host
(remote_host ist derselbe Server)
Ich gebe das Passwort ein und lande sofort wieder in der Eingabeaufforderung. Ich führe zur Überprüfung schnell „ps axu | grep ssh“ aus und sehe mir einen Prozess für den gerade ausgeführten SSH-Befehl an:
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
Ich gehe davon aus, dass mein Tunnel erfolgreich eingerichtet wurde.
Dann teste ich mit „telnet remote_host 1527“, aber das kann keine Verbindung herstellen; es hängt einfach mehrere Minuten, bevor ich es beende. Ich versuche den Telnet-Test mit verschiedenen Benutzern auf dem lokalen Host (einschließlich des Benutzernamens, den ich zum Erstellen des Tunnels verwendet habe) und das Ergebnis ist dasselbe – keine Verbindung.
Der Zweck dieses Tunnels ist die Verbindung zu einem Oracle Listener. Ich führe also denAbonnierenDienstprogramm; auch hier schlägt die Verbindung fehl. (Und ja, ich habe die Datenbankverbindung in der Datei tnsnames.ora richtig konfiguriert.)
Was habe ich falsch gemacht?
Antwort1
Sie telneten nicht zu remote_host, sondern zu localhost. Wenn Sie direkt zu remote_host telneten könnten, bräuchten Sie keinen Portnach vorne.
telnet localhost 1527
Von der SSH-Manpage:
-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.