温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

ssh登陆概率性失败,报错:kex_exchange_identification

发布时间:2020-06-28 02:13:14 来源:网络 阅读:25037 作者:e123nrt 栏目:系统运维

kex_exchange_identification: Connection closed by remote host

通过内网主机或者远程主机ssh登陆概率性失败,最高登陆失败率达到80%左右。

内网win主机登陆表现为登陆失败,需要反复登陆多次,因为这台主机是我内网的集中管控服务器,不能轻易的重装或者调整,整个大内网都靠它去监控和维护。期间尝试过更改各种配置,包括某乎帖子中的各种操作。   无效!!!

我只能默默的忍受~

我的解决办法是在xshell建立快捷方式,然后疯狂点击快捷方式登陆,好几个月的运维工作都是这么DT的过的,直到我,,,,再也不想忍受了。
ssh登陆概率性失败,报错:kex_exchange_identification

尝试从别的服务器ssh登陆,报错信息如下:

[root@localhost ]# ssh -vvv tset@192.168.XX.XX
OpenSSH_8.1p1, OpenSSL 1.0.2p  14 Aug 2018
debug1: Reading configuration data /etc/ssh/ssh_config
debug2: resolve_canonicalize: hostname 192.168.XX.XX is address
debug2: ssh_connect_direct
debug1: Connecting to 192.168.XX.XX [192.168.XX.XX] port 22.
debug1: Connection established.
debug1: identity file /root/.ssh/id_rsa type -1
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: identity file /root/.ssh/id_dsa type -1
debug1: identity file /root/.ssh/id_dsa-cert type -1
debug1: identity file /root/.ssh/id_ecdsa type -1
debug1: identity file /root/.ssh/id_ecdsa-cert type -1
debug1: identity file /root/.ssh/id_ed25519 type -1
debug1: identity file /root/.ssh/id_ed25519-cert type -1
debug1: identity file /root/.ssh/id_xmss type -1
debug1: identity file /root/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.1
kex_exchange_identification: Connection closed by remote host

百度报错信息无果,全是这个报错信息ssh_exchange_identification: Connection closed by remote host,根本没有我要找的KEX,无奈,只能尝试更改并行登陆参数和最大连接数。

MaxSessions:最大允许链接数,默认10.

MaxStartups:最大允许保持多少个未认证链接(未输入登录密码),默认值是10.

#MaxStartups 10:30:100  原配置指定SSH守护进程未经身份验证的并发连接的最大数量,默认值是 10:30:100。10:30:100表示的意思是,从第10个连接开始,以30%的概率(递增)拒绝新的连接,指导连接数达到100。

sshd的MaxStartups配置限制了可以并行认证的客户端数量为10,别问我为啥知道,自己登陆上去看cat /etc/ssh/sshd_config |grep MaxStartups 就知道了。

可查看ssh连接数
netstat -nat | grep -i '22' | wc -l  或者lsof -i:22 |wc -l

我将
MaxSessions 改成 2000
MaxStartups 也改成2000

然后重启sshd服务
世界终于太平无事了。
原来都是并发连接惹的祸。

ssh登录常见问题:

ssh登录常见的几种错误以及解决办法

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI