尝试访问我的 Ubuntu VM 时,我遇到了间歇性ssh
连接问题。请注意,这是一个间歇性问题。我已根据与此问题相关的可用帖子检查了/etc/hosts
、、文件hosts.allow
,hosts.deny
但未在这些配置文件中看到任何错误条目。请找到下面的调试 o/p
问题发生时
OpenSSH_7.2p2 Ubuntu-4ubuntu2.6, OpenSSL 1.0.2g 1 Mar 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: resolving "10.10.50.26" port 22
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to 10.10.50.26 [10.10.50.26] port 22.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file pem.pem type -1
debug1: key_load_public: No such file or directory
debug1: identity file pem.pem-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.6
ssh_exchange_identification: read: Connection reset by peer
O/p 工作时
OpenSSH_7.2p2 Ubuntu-4ubuntu2.6, OpenSSL 1.0.2g 1 Mar 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: resolving "10.10.50.26" port 22
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to 10.10.50.26 [10.10.50.26] port 22.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file pem.pem type -1
debug1: key_load_public: No such file or directory
debug1: identity file pem.pem-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.6
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.8
debug1: match: OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.8 pat OpenSSH_6.6.1* compat 0x04000000
debug2: fd 3 setting O_NONBLOCK
debug1: Authenticating to 10.10.50.26:22 as 'ubuntu'
debug3: hostkeys_foreach: reading file "/home/ubuntu/.ssh/known_hosts"
debug3: send packet: type 20
debug1: SSH2_MSG_KEXINIT sent
debug3: receive packet: type 20
debug1: SSH2_MSG_KEXINIT received
debug2: local client KEXINIT proposal
您能帮忙解决这个问题吗?提前致谢
答案1
这里有人问了类似的问题:https://superuser.com/questions/856989/ssh-error-ssh-exchange-identification-read-connection-reset-by-peer。
tl;dr 检查您的防火墙并确保您没有被阻止。
我最近遇到了这个问题。后来我发现我的防火墙将流量视为 ssh 暴力攻击并将其阻止。添加防火墙规则后,问题得到解决。
笔记:
- 我的 ssh 流量来自 Jenkins。防火墙将来自该服务器的所有 ssh 流量视为 ssh 暴力攻击,并开始阻止请求。
- 当我们的内部部署 Jenkins 服务器开始与我们新托管在云上的源管理服务器通信时出现了这个问题。