从新安装的 Ubuntu 16.04 开始,我无法通过 SSH 隧道连接到某些主机。
另一个奇怪的是,当尝试建立隧道时,通过
$ ssh -fN -L 2222:192.168.1.115:22 [email protected]
我得到了:
Unable to negotiate with 1.2.3.4 port 22: no matching key exchange method found. Their offer: diffie-hellman-group1-sha1
我通过指定以下内容修复了此问题:
$ ssh -fN -L 2222:192.168.1.115:22 -oKexAlgorithms=+diffie-hellman-group1-sha1 [email protected]
隧道建立后,尝试通过它连接到指定主机,方式如下:
$ ssh -p 2222 -vvvv [email protected]
挂起大约一分半钟,时间是:
$ ssh -p 2222 -vvvv [email protected]
OpenSSH_7.2p2 Ubuntu-4, OpenSSL 1.0.2g-fips 1 Mar 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: resolving "127.0.0.1" port 2222
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to 127.0.0.1 [127.0.0.1] port 2222.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /home/ansel/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/ansel/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/ansel/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/ansel/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/ansel/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/ansel/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/ansel/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/ansel/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.2p2 Ubuntu-4
大约 3 分钟后它最终失败:
channel 4: open failed: connect failed:
ssh_exchange_identification: Connection closed by remote host
从其他设备/操作系统(例如 Android 上的 ConnectBot)进行的连接可以按预期进行。
有人能提供一些故障排除指南吗?