Ich versuche, lokale Portweiterleitung einzurichten, aber ich bin auf zwei Schwierigkeiten gestoßen:
Bei Verwendung der ssh -vL 1083:127.0.0.1:22 akveton2@cms904usr -N
Befehl, ich bekomme diesen Fehler:
bind: Angeforderte Adresse kann nicht zugewiesen werden
Ich habe ein bisschen gegoogelt und seitdem herausgefunden, dass, wenn diese Zeile in der Debug-Ausgabe enthalten ist, versucht wird, eine Verbindung mit IPv6 herzustellen:
debug1: Lokale Weiterleitung für :: 1 Port 1083.
Ich habe dem Befehl jetzt das Argument -4 hinzugefügt, sodass der Bindungsfehler nicht mehr gedruckt wird. Jetzt hängt die Verbindung jedoch nach Eingabe des Kennworts. Was könnte das Problem sein? Hier ist das Protokoll:
[akveton@lxplus070 ~]$ ssh -vL 1083:127.0.0.1:1083 akveton2@cms904usr -N
OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to cms904usr [137.138.251.206] port 22.
debug1: Connection established.
debug1: identity file /afs/cern.ch/user/a/akveton/.ssh/identity type -1
debug1: identity file /afs/cern.ch/user/a/akveton/.ssh/identity-cert type -1
debug1: identity file /afs/cern.ch/user/a/akveton/.ssh/id_rsa type -1
debug1: identity file /afs/cern.ch/user/a/akveton/.ssh/id_rsa-cert type -1
debug1: identity file /afs/cern.ch/user/a/akveton/.ssh/id_dsa type -1
debug1: identity file /afs/cern.ch/user/a/akveton/.ssh/id_dsa-cert type -1
debug1: identity file /afs/cern.ch/user/a/akveton/.ssh/id_ecdsa type -1
debug1: identity file /afs/cern.ch/user/a/akveton/.ssh/id_ecdsa-cert type -1
debug1: Remote protocol version 1.99, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.3
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-sha1 none
debug1: kex: client->server aes128-ctr hmac-sha1 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<2048<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'cms904usr' is known and matches the RSA host key.
debug1: Found key in /afs/cern.ch/user/a/akveton/.ssh/known_hosts:13
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: gssapi-keyex
debug1: No valid Key exchange context
debug1: Next authentication method: gssapi-with-mic
debug1: Unspecified GSS failure. Minor code may provide more information
Server not found in Kerberos database
debug1: Authentications that can continue: gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: password
akveton2@cms904usr's password:
debug1: Authentication succeeded (password).
debug1: Local connections to LOCALHOST:1083 forwarded to remote address 127.0.0.1:1083
debug1: Local forwarding listening on 127.0.0.1 port 1083.
debug1: channel 0: new [port listener]
debug1: Local forwarding listening on ::1 port 1083.
bind: Cannot assign requested address
debug1: Requesting [email protected]
debug1: Entering interactive session.
^Cdebug1: channel 0: free: port listener, nchannels 1
Killed by signal 2.
[akveton@lxplus070 ~]$ ssh -v4L 1083:127.0.0.1:22 akveton2@cms904usr -N^C
[akveton@lxplus070 ~]$ ssh -v4L 1083:127.0.0.1:1083 akveton2@cms904usr -N
OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to cms904usr [137.138.251.206] port 22.
debug1: Connection established.
debug1: identity file /afs/cern.ch/user/a/akveton/.ssh/identity type -1
debug1: identity file /afs/cern.ch/user/a/akveton/.ssh/identity-cert type -1
debug1: identity file /afs/cern.ch/user/a/akveton/.ssh/id_rsa type -1
debug1: identity file /afs/cern.ch/user/a/akveton/.ssh/id_rsa-cert type -1
debug1: identity file /afs/cern.ch/user/a/akveton/.ssh/id_dsa type -1
debug1: identity file /afs/cern.ch/user/a/akveton/.ssh/id_dsa-cert type -1
debug1: identity file /afs/cern.ch/user/a/akveton/.ssh/id_ecdsa type -1
debug1: identity file /afs/cern.ch/user/a/akveton/.ssh/id_ecdsa-cert type -1
debug1: Remote protocol version 1.99, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.3
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-sha1 none
debug1: kex: client->server aes128-ctr hmac-sha1 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<2048<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'cms904usr' is known and matches the RSA host key.
debug1: Found key in /afs/cern.ch/user/a/akveton/.ssh/known_hosts:13
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: gssapi-keyex
debug1: No valid Key exchange context
debug1: Next authentication method: gssapi-with-mic
debug1: Unspecified GSS failure. Minor code may provide more information
Server not found in Kerberos database
debug1: Authentications that can continue: gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: password
akveton2@cms904usr's password:
debug1: Authentication succeeded (password).
debug1: Local connections to LOCALHOST:1083 forwarded to remote address 127.0.0.1:1083
debug1: Local forwarding listening on 127.0.0.1 port 1083.
debug1: channel 0: new [port listener]
debug1: Requesting [email protected]
debug1: Entering interactive session.
Einige weitere Symptome:
Wenn ich zwei Terminals öffne, eines, an dem ich den Tunnel durchführe, und eines mit Curl:
Ich tippe curl --socks5 localhost:1083 http://cms904usr
in das zweite Terminal, und ich bekomme:
curl: (7) SOCKS5-Verbindungsanforderungsbestätigung konnte nicht empfangen werden.
Gleichzeitig wird das erste Terminal ausgedruckt
Kanal 1: Öffnen fehlgeschlagen: Verbindung fehlgeschlagen: Verbindung abgelehnt
Wenn ich schreibe curl --proxy localhost:1083 http://cms904usr
in das zweite terminal komme ich
curl: (52) Leere Antwort vom Server
und nichts im ersten Terminal.
Wenn ich versuche, mit Firefox eine Verbindung herzustellen, bekomme ich
Der Proxy-Server verweigert Verbindungen
quelle